Skip to content
Advertisement

Tag: unit-testing

Jest: Failed prop type: Invalid prop `source` supplied to `Image`, expected one of type [number]

I am using jest with react-native to run unit test cases. And whenever it encounters Image it throws the following warning I tried to replace the code to as suggested in https://stackoverflow.com/a/36460928/3855179 but it started throwing the following warning and the application breaks Any idea how this can be handled? Answer It would be helpful to see your file structure

Module pattern variable returning undefined in test?

I have the following code below which returns certain data depending on NODE_ENV: config.js This works well in my component when I set NODE_ENV. However in my test, I keep getting undefined as a result. config.test.js Again, Config.data works fine in my React component when I start it up, but I guess I need to somehow initialize this for it

Issue with setting up jest mock

I have the following function that is used within cypress tests for which I want to do unit testing (filterTests.js): A test double for Cypress.env needs to be created. I’m not sure if this would technically be considered a stub, mock, fake, dummy, etc…, but the philosophical discussion isn’t the focus right now. It looks like in the Cypress world,

Jest coverage tools fail

During in my react-native project, during test execution, Jest shows coverage and creates coverage reports. Jest config: During testing I get errors: in files which are generated during creation of coverage folder: So, in jest documentation we see that we can specify jsdom environment in file which produces error like: Ok, but here we have auto-generated files, not my test-files.

Advertisement