rt2zz/redux-persist

Jest snapshot is always created as null in react native

chetangwl opened this issue · 0 comments

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()
    })
})