generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/taskDates/1252
- Loading branch information
Showing
8 changed files
with
363 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { DONE, VERIFIED } from '@/constants/task-status'; | ||
import task, { Tab } from '@/interfaces/task.type'; | ||
import getFilteredTasks from '@/utils/getFilteredTasks'; | ||
import { TASK } from '../../../fixture/task'; | ||
|
||
let VERIFIED_TASKS: task[]; | ||
let TASKS_HAVING_TITLE_DONE: task[]; | ||
let ALL_TASKS: task[]; | ||
|
||
beforeAll(() => { | ||
VERIFIED_TASKS = [ | ||
{ ...TASK, status: VERIFIED, id: TASK.id + 2 }, | ||
{ ...TASK, status: VERIFIED, id: TASK.id + 3 }, | ||
]; | ||
TASKS_HAVING_TITLE_DONE = [ | ||
{ ...TASK, id: TASK.id + 1, title: DONE }, | ||
{ ...TASK, title: DONE, status: DONE, id: TASK.id + 4 }, | ||
]; | ||
ALL_TASKS = [...TASKS_HAVING_TITLE_DONE, ...VERIFIED_TASKS]; | ||
}); | ||
|
||
describe('Unit | Util | Get Filtered Tasks', () => { | ||
test('should return an empty list', () => { | ||
expect(getFilteredTasks([], Tab.ALL, '')).toStrictEqual([]); | ||
}); | ||
|
||
test('should return all tasks', () => { | ||
expect(getFilteredTasks(ALL_TASKS, Tab.ALL, '')).toStrictEqual( | ||
ALL_TASKS | ||
); | ||
}); | ||
|
||
test('should return all tasks with verified status', () => { | ||
expect(getFilteredTasks(ALL_TASKS, Tab.VERIFIED, '')).toStrictEqual( | ||
VERIFIED_TASKS | ||
); | ||
}); | ||
|
||
test('should return all tasks with `verified` status and title `Testing and Determinsitic State`', () => { | ||
expect( | ||
getFilteredTasks( | ||
ALL_TASKS, | ||
Tab.VERIFIED, | ||
'Testing and Determinsitic State' | ||
) | ||
).toStrictEqual(VERIFIED_TASKS); | ||
}); | ||
|
||
test('should return all tasks with title `DONE`', () => { | ||
expect(getFilteredTasks(ALL_TASKS, Tab.ALL, DONE)).toStrictEqual( | ||
TASKS_HAVING_TITLE_DONE | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Tab } from '@/interfaces/task.type'; | ||
import getInputValueFromTaskField from '@/utils/getInputValueFromTaskField'; | ||
|
||
describe('Unit | Util | Get Input Value From Task Field', () => { | ||
test('should return proper value for `all` tab', () => { | ||
expect(getInputValueFromTaskField(Tab.ALL, '')).toBe('status:all'); | ||
}); | ||
|
||
test('should return proper value for `assigned` tab and `done` title', () => { | ||
expect(getInputValueFromTaskField(Tab.ASSIGNED, 'done')).toBe( | ||
'status:assigned done' | ||
); | ||
}); | ||
|
||
test('should return proper value for `all` tab and `done` title', () => { | ||
expect(getInputValueFromTaskField(Tab.ALL, 'done')).toBe( | ||
'status:all done' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export const TASK = { | ||
id: 'firestoreDocumentId123', | ||
lossRate: { | ||
dinero: 10, | ||
neelam: 5, | ||
}, | ||
links: ['https://realdevsquad.com/learn-site'], | ||
completionAward: { | ||
dinero: 110, | ||
neelam: 10, | ||
}, | ||
dependsOn: [], | ||
assignee: 'shmbajaj', | ||
startedOn: '1618790400', | ||
isNoteworthy: true, | ||
title: 'Testing and Determinsitic State', | ||
purpose: 'string', | ||
percentCompleted: 0, | ||
endsOn: 1618790400, | ||
status: 'progress', | ||
featureUrl: 'progress', | ||
type: 'feature', | ||
createdBy: 'shmbajaj', | ||
priority: 'TBD', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.