Skip to content

Commit 46cb02d

Browse files
committed
Revert "fix: TT-299 removal of variables and tests which are no longer neccessary"
This reverts commit a49eb5e.
1 parent 005aa6b commit 46cb02d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/app/modules/activities-management/store/activity-management.reducers.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,20 @@ describe('activityManagementReducer', () => {
142142
expect(state.message).toEqual('Something went wrong unarchiving activities!');
143143
expect(state.isLoading).toBeFalse();
144144
});
145+
146+
it('on SetActivityToEdit, should save the activityId to edit', () => {
147+
const action = new actions.SetActivityToEdit(activity.id);
148+
149+
const state = activityManagementReducer(initialState, action);
150+
151+
expect(state.activityIdToEdit).toEqual('1');
152+
});
153+
154+
it('on ResetActivityToEdit, should clean the activityIdToEdit variable', () => {
155+
const action = new actions.ResetActivityToEdit();
156+
157+
const state = activityManagementReducer(initialState, action);
158+
159+
expect(state.activityIdToEdit).toEqual('');
160+
});
145161
});

src/app/modules/activities-management/store/activity-management.reducers.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export function activityManagementReducer(state: ActivityState = initialState, a
6868
...state,
6969
isLoading: true,
7070
message: 'Set activityIdToArchive property',
71+
activityIdToEdit: action.activityId,
7172
};
7273
}
7374

@@ -88,6 +89,7 @@ export function activityManagementReducer(state: ActivityState = initialState, a
8889
data: [],
8990
isLoading: false,
9091
message: 'Something went wrong deleting activity!',
92+
activityIdToEdit: '',
9193
};
9294
}
9395

@@ -125,6 +127,7 @@ export function activityManagementReducer(state: ActivityState = initialState, a
125127
...state,
126128
isLoading: true,
127129
message: 'Set activityIdToUnarchive property',
130+
activityIdToEdit: action.payload,
128131
};
129132
}
130133

@@ -137,6 +140,7 @@ export function activityManagementReducer(state: ActivityState = initialState, a
137140
data: activityList,
138141
isLoading: false,
139142
message: 'Unarchive activity successfully!',
143+
activityIdToEdit: '',
140144
};
141145
}
142146

@@ -145,6 +149,7 @@ export function activityManagementReducer(state: ActivityState = initialState, a
145149
...state,
146150
isLoading: false,
147151
message: 'Something went wrong unarchiving activities!',
152+
activityIdToEdit: '',
148153
};
149154
}
150155

0 commit comments

Comments
 (0)