react-native-calendars
react-native-calendars copied to clipboard
Cannot read property 'locales' of undefined
Please make our job easier by filling this template out to completion. If you're requesting a feature instead of reporting a bug, please feel free to skip the Environment and Reproducible Demo sections.
Description
Im writing tests with jest and I having this error
Expected Behavior
Add a mock should be enough
Observed Behavior

FAIL src/state/rtc/sagas/index.test.js
● Test suite failed to run
TypeError: Cannot read property 'locales' of undefined
22 | Object.keys(resources || []).forEach((locale) => {
23 | console.log('local', locale, LocaleConfig)
> 24 | LocaleConfig.locales[locale] = {
| ^
25 | monthNames: moment
26 | .localeData(locale)
27 | .months()
at forEach (src/i18n/index.js:24:16)
at Array.forEach (<anonymous>)
at Object.<anonymous> (src/i18n/index.js:22:30)
at Object.<anonymous> (src/state/preferences/sagas.js:8:1)
console.log
local en undefined
at forEach (src/i18n/index.js:23:11)
at Array.forEach (<anonymous>)
Environment
Please run these commands in the project folder and fill in their results:
-
npm ls react-native-calendars
: [email protected] -
npm ls react-native
: [email protected]
Also specify:
Runing test in Mac
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm getting this error too. How did you fix it?