Skip to content

Commit

Permalink
Test : Added test for status conversion based on flag
Browse files Browse the repository at this point in the history
  • Loading branch information
joyguptaa committed Dec 14, 2023
1 parent dcb2df2 commit 49958bd
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/fixtures/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@ const tasks = [
featureUrl: 'aliqua non minim',
purpose: 'quis nostrud deserunt',
},
{
id: 't5',
title: 'Task Object 1',
startedOn: 1662800000,
isNoteworthy: true,
endsOn: 1662803133,
percentCompleted: 100,
type: 'eu',
status: 'COMPLETED',
assignee: 'user1',
featureUrl: 'aliqua non minim',
purpose: 'quis nostrud deserunt',
},
{
id: 't6',
title: 'Task Object 1',
startedOn: 1662800000,
isNoteworthy: true,
endsOn: 1662803133,
percentCompleted: 100,
type: 'eu',
status: 'DONE',
assignee: 'user1',
featureUrl: 'aliqua non minim',
purpose: 'quis nostrud deserunt',
},
];

const overDueTask = {
Expand Down
46 changes: 46 additions & 0 deletions tests/integration/components/tasks/holder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,50 @@ module('Integration | Component | Tasks Holder', function (hooks) {
assert.dom('[data-test-task-status-select]').exists();
assert.dom('[data-test-dropdown-option=Done]').hasText('Done');
});

test('Render Task holder and check if COMPLETED status is being converted to DONE in dev mode', async function (assert) {
this.set('task', tasksData[4]);
this.set('mock', () => {});
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);
this.set('dev', true);

await render(hbs`<Task::Holder
@task={{this.task}}
@onTaskChange={{this.mock}}
@onStausChange={{this.mock}}
@onTaskUpdate={{this.mock}}
@isLoading={{this.isLoading}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
@dev={{this.dev}}
/>`);

assert.dom('[data-test-task-status-select]').exists();
assert.dom('[data-test-dropdown-option=Done]').hasText('Done');
});

test('Render Task holder and check if DONE status is being converted to COMPLETED without dev mode', async function (assert) {
this.set('task', tasksData[5]);
this.set('mock', () => {});
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);
this.set('dev', false);

await render(hbs`<Task::Holder
@task={{this.task}}
@onTaskChange={{this.mock}}
@onStausChange={{this.mock}}
@onTaskUpdate={{this.mock}}
@isLoading={{this.isLoading}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
@dev={{this.dev}}
/>`);

assert.dom('[data-test-task-status-select]').exists();
assert.dom('[data-test-dropdown-option=Completed]').hasText('Completed');
});
});

0 comments on commit 49958bd

Please sign in to comment.