Skip to content

Commit 23f729b

Browse files
Merge pull request #3006 from OneCommunityGlobal/aaryaneil-Unit-Test-ownerMessageReducer
Aaryaneil - Unit Test for ownerMessageReducer
2 parents 6f59d21 + 9573e72 commit 23f729b

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { ownerMessageReducer } from "../ownerMessageReducer";
2+
import * as types from "../../constants/ownerMessageConstants";
3+
4+
describe("ownerMessageReducer", () => {
5+
const initialState = {
6+
message: '',
7+
standardMessage: '',
8+
};
9+
10+
it("should return the initial state when no action is provided", () => {
11+
expect(ownerMessageReducer(undefined, {})).toEqual(initialState);
12+
});
13+
14+
it("should handle UPDATE_OWNER_MESSAGE", () => {
15+
const action = {
16+
type: types.UPDATE_OWNER_MESSAGE,
17+
payload: {
18+
message: "Updated owner message",
19+
standardMessage: "This is the standard message",
20+
},
21+
};
22+
23+
const expectedState = {
24+
message: "Updated owner message",
25+
standardMessage: "This is the standard message",
26+
};
27+
28+
expect(ownerMessageReducer(initialState, action)).toEqual(expectedState);
29+
});
30+
31+
it("should return the current state for an unknown action type", () => {
32+
const unknownAction = {
33+
type: "UNKNOWN_ACTION",
34+
};
35+
36+
expect(ownerMessageReducer(initialState, unknownAction)).toEqual(initialState);
37+
});
38+
});

0 commit comments

Comments
 (0)