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

Jest snapshot is always created as null in react native #1449

Open
chetangwl opened this issue Jul 24, 2023 · 0 comments
Open

Jest snapshot is always created as null in react native #1449

chetangwl opened this issue Jul 24, 2023 · 0 comments

Comments

@chetangwl
Copy link

chetangwl commented Jul 24, 2023

I am trying to generate a snapshot using jest in React Native. But it always creates a null snapshot and also does not covers the file for code coverage.
For reference please see the below code.

SignInScreen.test.tsx.snap

exports[renders correctly renders correctly sign in view 1] = null;

SignInScreen.test.tsx

import React from 'react'
import { Provider } from 'react-redux'
import renderer from 'react-test-renderer'
import { persistStore } from 'redux-persist'
import { PersistGate } from 'redux-persist/integration/react'
import store from '../../../store/store'
import SignInScreen from './SignInScreen'
const persistor = persistStore(store)

jest.useFakeTimers()

describe('renders correctly', () => {
    const wrapper = renderer.create(
        <Provider store={store}>
            <PersistGate loading={null} persistor={persistor}>
                <SignInScreen />
            </PersistGate>
        </Provider>,
    )
    it('renders correctly sign in view ', () => {
        expect(wrapper.toJSON()).toMatchSnapshot()
    })
})
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

1 participant