mirror of
https://github.com/TheGreyDiamond/Enlight.git
synced 2026-04-01 07:10:23 +02:00
32 lines
812 B
TypeScript
32 lines
812 B
TypeScript
import { AnyAction } from 'redux';
|
|
import counterReducer, {
|
|
increment,
|
|
decrement,
|
|
} from '../../app/features/counter/counterSlice';
|
|
|
|
describe('reducers', () => {
|
|
describe('counter', () => {
|
|
it('should handle initial state', () => {
|
|
expect(counterReducer(undefined, {} as AnyAction)).toMatchSnapshot();
|
|
});
|
|
|
|
it('should handle INCREMENT_COUNTER', () => {
|
|
expect(
|
|
counterReducer({ value: 1 }, { type: increment })
|
|
).toMatchSnapshot();
|
|
});
|
|
|
|
it('should handle DECREMENT_COUNTER', () => {
|
|
expect(
|
|
counterReducer({ value: 1 }, { type: decrement })
|
|
).toMatchSnapshot();
|
|
});
|
|
|
|
it('should handle unknown action type', () => {
|
|
expect(
|
|
counterReducer({ value: 1 }, { type: 'unknown' })
|
|
).toMatchSnapshot();
|
|
});
|
|
});
|
|
});
|