Files
it-incubator-todolist-ts-17…/src/app/app-reducer.test.ts

27 lines
557 B
TypeScript

import {
appReducer,
InitialState,
setAppError,
setAppStatus,
} from './app-reducer'
let startState: InitialState
beforeEach(() => {
startState = {
error: null,
status: 'idle',
isInitialized: false,
}
})
test('correct error message should be set', () => {
const endState = appReducer(startState, setAppError('some error'))
expect(endState.error).toBe('some error')
})
test('correct status should be set', () => {
const endState = appReducer(startState, setAppStatus('loading'))
expect(endState.status).toBe('loading')
})