Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Cannot read property 'LENGTH_LONG' of undefined #194

Open
vijaemanlapaz opened this issue Feb 18, 2022 · 7 comments
Open

[Test] Cannot read property 'LENGTH_LONG' of undefined #194

vijaemanlapaz opened this issue Feb 18, 2022 · 7 comments

Comments

@vijaemanlapaz
Copy link

vijaemanlapaz commented Feb 18, 2022

I'm getting error Cannot read property 'LENGTH_LONG' of undefined when i do yarn test
i'm using version 2.4.0

Environment
react-native: 0.65.2 => 0.65.2

Steps i did so far

  • yarn clean
  • yarn install
  • npx react-native link react-native-snackbar
@viral-synoverge
Copy link

how to resolve this ? any one able to find the solution ?

@joseananio
Copy link

joseananio commented Mar 18, 2022

see this issue: #43.
its on regular usage but you might find something

Also ensure your pods are installed (RNSnackbar (2.4.0)).

@atul898
Copy link

atul898 commented Mar 24, 2022

I am getting a similar message - "Cannot read properties of undefined (reading 'LENGTH_LONG')"
Functionality is all good, this issue is specific to when running tests
We are on React Native "0.67.2", using "2.4.0" of react-native-snackbar
Already went through issue #43 and tried everything.

@GewoonJaap
Copy link

I am getting a similar message - "Cannot read properties of undefined (reading 'LENGTH_LONG')" Functionality is all good, this issue is specific to when running tests We are on React Native "0.67.2", using "2.4.0" of react-native-snackbar Already went through issue #43 and tried everything.

Same issue here, works fine when using the app, however once I run Jest it will fail. Already added the package to Jest transformIgnorePatterns, without result

@ZeeshanAhmadKhalil
Copy link

I was getting this issue, uninstalling app, closing metro server and running app again worked for me.

@aravi365
Copy link

Any working solution or fixes on this issue?

@jakequade
Copy link

If anyone is struggling with this, you can create a mock in your jest.setup.js:

jest.mock('react-native-clipboard', () => ({
    LENGTH_SHORT: 5,
    LENGTH_LONG: 10,
    LENGTH_INDEFINITIE: -1,
    show: jest.fn(),
    dismiss: jest.fn(),
})

I've addressed this in a PR, here: #210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants