1
1
import reducer , { initialState } from '@/shared/sharedReducer' ; // Replace 'yourReducer' with the actual file path
2
- import { actionCreators } from '@/shared/base' ;
2
+ import { actionTypes } from '@/shared/base' ;
3
3
4
4
describe ( 'sharedReducer tests' , ( ) => {
5
5
beforeEach ( ( ) => {
6
6
jest . clearAllMocks ( ) ;
7
7
} ) ;
8
8
9
9
it ( 'should handle API_REQUEST action' , ( ) => {
10
- const action = { type : actionCreators . API_REQUEST } ;
10
+ const action = { type : actionTypes . API_REQUEST } ;
11
11
const newState = reducer ( initialState , action ) ;
12
12
13
13
expect ( newState . requestInProgress ) . toBe ( true ) ;
14
14
expect ( newState . count ) . toBe ( 1 ) ;
15
15
} ) ;
16
16
17
17
it ( 'should handle API_REQUEST_DONE action' , ( ) => {
18
- const action = { type : actionCreators . API_REQUEST_DONE } ;
18
+ const action = { type : actionTypes . API_REQUEST_DONE } ;
19
19
20
20
const newState = reducer ( initialState , action ) ;
21
21
@@ -25,7 +25,7 @@ describe('sharedReducer tests', () => {
25
25
26
26
it ( 'should handle SET_ALERT action' , ( ) => {
27
27
const action = {
28
- type : actionCreators . SET_ALERT ,
28
+ type : actionTypes . SET_ALERT ,
29
29
message : 'Sample alert message' ,
30
30
alertType : 'success' ,
31
31
} ;
@@ -38,7 +38,7 @@ describe('sharedReducer tests', () => {
38
38
39
39
it ( 'should handle CLEAR_ALERT action' , ( ) => {
40
40
const action = {
41
- type : actionCreators . CLEAR_ALERT ,
41
+ type : actionTypes . CLEAR_ALERT ,
42
42
} ;
43
43
44
44
const stateWithAlert = {
@@ -55,7 +55,7 @@ describe('sharedReducer tests', () => {
55
55
56
56
it ( 'should handle OPEN_CONFIRMATION_MODAL action' , ( ) => {
57
57
const action = {
58
- type : actionCreators . OPEN_CONFIRMATION_MODAL ,
58
+ type : actionTypes . OPEN_CONFIRMATION_MODAL ,
59
59
title : 'Confirmation Title' ,
60
60
message : 'Are you sure?' ,
61
61
text : 'Confirm' ,
@@ -82,7 +82,7 @@ describe('sharedReducer tests', () => {
82
82
83
83
it ( 'should handle LOAD_COMPONENT action' , ( ) => {
84
84
const action = {
85
- type : actionCreators . LOAD_COMPONENT ,
85
+ type : actionTypes . LOAD_COMPONENT ,
86
86
} ;
87
87
88
88
const newState = reducer ( initialState , action ) ;
@@ -93,7 +93,7 @@ describe('sharedReducer tests', () => {
93
93
94
94
it ( 'should handle COMPONENT_NOT_FOUND action' , ( ) => {
95
95
const action = {
96
- type : actionCreators . COMPONENT_NOT_FOUND ,
96
+ type : actionTypes . COMPONENT_NOT_FOUND ,
97
97
} ;
98
98
99
99
const newState = reducer ( initialState , action ) ;
0 commit comments