mirror of
https://github.com/Mastermindzh/react-starter-kit.git
synced 2025-08-23 09:35:01 +02:00
Moved examples into example directory
Moved routes to separate file Used route constants
This commit is contained in:
30
src/features/examples/counter/state/counterSlice.spec.ts
Normal file
30
src/features/examples/counter/state/counterSlice.spec.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import counterReducer, { increment, decrement, incrementByAmount } from "./counterSlice";
|
||||
import { CounterState } from "../models/CounterState";
|
||||
|
||||
describe("counter reducer", () => {
|
||||
const initialState: CounterState = {
|
||||
value: 3,
|
||||
status: "idle",
|
||||
};
|
||||
it("should handle initial state", () => {
|
||||
expect(counterReducer(undefined, { type: "unknown" })).toEqual({
|
||||
value: 0,
|
||||
status: "idle",
|
||||
});
|
||||
});
|
||||
|
||||
it.only("should handle increment", () => {
|
||||
const actual = counterReducer(initialState, increment());
|
||||
expect(actual.value).toEqual(4);
|
||||
});
|
||||
|
||||
it("should handle decrement", () => {
|
||||
const actual = counterReducer(initialState, decrement());
|
||||
expect(actual.value).toEqual(2);
|
||||
});
|
||||
|
||||
it("should handle incrementByAmount", () => {
|
||||
const actual = counterReducer(initialState, incrementByAmount(2));
|
||||
expect(actual.value).toEqual(5);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user