mirror of
https://github.com/ershisan99/it-incubator-todolist-ts-17-live-2024-08-17.git
synced 2025-12-16 20:59:30 +00:00
27 lines
565 B
TypeScript
27 lines
565 B
TypeScript
import {
|
|
appReducer,
|
|
InitialStateType,
|
|
setAppError,
|
|
setAppStatus,
|
|
} from './app-reducer'
|
|
|
|
let startState: InitialStateType
|
|
|
|
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')
|
|
})
|