eduardomoroni/mtgx

View on GitHub
__tests__/unit/src/redux/reducers/authenticationReducer.test.js

Summary

Maintainability
A
0 mins
Test Coverage
import { setUser } from '../../../../../src/redux/actions/authenticationActions'
import { firebaseUser } from '../../../../assets/fixtures/firebaseUserFixture'
import { User } from '../../../../../src/services/firebase/user'
import AuthenticationReducer, { initialState } from '../../../../../src/redux/reducers/authenticationReducer'

describe('Authentication reducer', () => {
  it('should have a snapshot', async () => {
    expect(initialState).toMatchSnapshot()
  })

  it('should set a user to state', async () => {
    const user = new User(firebaseUser)
    const action = setUser(user)
    const state = AuthenticationReducer(initialState, action)

    expect(state).toEqual(user)
  })
})