This commit is contained in:
2024-08-17 17:13:28 +02:00
commit 143b48c7a9
38 changed files with 11982 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { appReducer, InitialStateType, setAppErrorAC, setAppStatusAC } 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, setAppErrorAC('some error'))
expect(endState.error).toBe('some error');
})
test('correct status should be set', () => {
const endState = appReducer(startState, setAppStatusAC('loading'))
expect(endState.status).toBe('loading');
})