1+ import { userTeamMembersReducer } from '../userTeamMembersReducer' ;
2+
3+ describe ( 'userTeamMembersReducer' , ( ) => {
4+ const initialState = null ;
5+
6+ it ( 'should return the initial state when no action is provided' , ( ) => {
7+ const result = userTeamMembersReducer ( undefined , { } ) ;
8+ expect ( result ) . toEqual ( initialState ) ;
9+ } ) ;
10+
11+ it ( 'should handle GET_USER_TEAM_MEMBERS action' , ( ) => {
12+ const action = {
13+ type : 'GET_USER_TEAM_MEMBERS' ,
14+ payload : [
15+ { id : 1 , name : 'Member 1' } ,
16+ { id : 2 , name : 'Member 2' } ,
17+ ] ,
18+ } ;
19+
20+ const expectedState = action . payload ;
21+
22+ const result = userTeamMembersReducer ( initialState , action ) ;
23+ expect ( result ) . toEqual ( expectedState ) ;
24+ } ) ;
25+
26+ it ( 'should return the same state for unknown action types' , ( ) => {
27+ const unknownAction = { type : 'UNKNOWN_ACTION' } ;
28+ const result = userTeamMembersReducer ( initialState , unknownAction ) ;
29+ expect ( result ) . toEqual ( initialState ) ;
30+ } ) ;
31+
32+ it ( 'should return null if the team members state is null' , ( ) => {
33+ const action = {
34+ type : 'GET_USER_TEAM_MEMBERS' ,
35+ payload : [ { id : 1 , name : 'New Member' } ] ,
36+ } ;
37+
38+ const result = userTeamMembersReducer ( null , action ) ;
39+ expect ( result ) . toEqual ( action . payload ) ;
40+ } ) ;
41+ } ) ;
0 commit comments