Skip to content

Commit 0a25087

Browse files
committed
Implementing ordered activities test
1 parent b4d405e commit 0a25087

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,59 @@ describe('EntryFieldsComponent', () => {
355355
type: ActivityManagementActionTypes.LOAD_ACTIVITIES_SUCCESS,
356356
payload: [],
357357
};
358-
358+
359359
actionSubject.next(action);
360360

361361
expect(component.activities).toEqual(action.payload);
362362
});
363363

364+
it('activites are ordered using the payload of the action', () => {
365+
const listActivities = [
366+
{
367+
id: '001',
368+
name: 'Meeting',
369+
description: 'Some description'
370+
},
371+
{
372+
id: '002',
373+
name: 'ABC',
374+
description: 'Some description'
375+
},
376+
{
377+
id: '003',
378+
name: 'XYZ',
379+
description: 'Some description'
380+
},
381+
];
382+
383+
const listActivitiesOrdered = [
384+
{
385+
id: '002',
386+
name: 'ABC',
387+
description: 'Some description'
388+
},
389+
{
390+
id: '001',
391+
name: 'Meeting',
392+
description: 'Some description'
393+
},
394+
{
395+
id: '003',
396+
name: 'XYZ',
397+
description: 'Some description'
398+
},
399+
];
400+
const actionSubject = TestBed.inject(ActionsSubject) as ActionsSubject;
401+
const action = {
402+
type: ActivityManagementActionTypes.LOAD_ACTIVITIES_SUCCESS,
403+
payload: listActivities,
404+
};
405+
406+
actionSubject.next(action);
407+
408+
expect(component.activities).toEqual(listActivitiesOrdered);
409+
});
410+
364411
it('LoadActiveEntry is dispatchen after LOAD_ACTIVITIES_SUCCESS', () => {
365412
spyOn(store, 'dispatch');
366413

0 commit comments

Comments
 (0)