diff --git a/app/components/user-status-modal.hbs b/app/components/user-status-modal.hbs index 0cce16c1..b2edafd6 100644 --- a/app/components/user-status-modal.hbs +++ b/app/components/user-status-modal.hbs @@ -10,9 +10,6 @@ Reason - {{else if (eq @newStatus this.USER_STATES.IDLE)}} - What skills are you willing to - learn {{/if}} If you are not a developer, please contact Ankush for next steps. - - Change your status to Active - {{else}} {{currentStatus.message}} @@ -31,7 +27,7 @@ {{#each this.currentUserStatus as |currentStatus|}} {{#if (eq @status currentStatus.status)}} {{#each currentStatus.otherAvailableStatus as |otherPossibleStatus|}} - + {{otherPossibleStatus.message}} {{/each}} diff --git a/app/components/user-status.js b/app/components/user-status.js index d1d0b125..b5efbcd6 100644 --- a/app/components/user-status.js +++ b/app/components/user-status.js @@ -24,26 +24,17 @@ export default class UserStatusComponent extends Component { { status: USER_STATES.ACTIVE, message: 'You are Active', - otherAvailableStatus: [ - this.ALL_FEASIBLE_STATUS.IDLE, - this.ALL_FEASIBLE_STATUS.OOO, - ], + otherAvailableStatus: [this.ALL_FEASIBLE_STATUS.OOO], }, { status: USER_STATES.IDLE, message: 'You are Idle', - otherAvailableStatus: [ - this.ALL_FEASIBLE_STATUS.ACTIVE, - this.ALL_FEASIBLE_STATUS.OOO, - ], + otherAvailableStatus: [this.ALL_FEASIBLE_STATUS.OOO], }, { status: USER_STATES.OOO, message: 'You are OOO', - otherAvailableStatus: [ - this.ALL_FEASIBLE_STATUS.ACTIVE, - this.ALL_FEASIBLE_STATUS.IDLE, - ], + otherAvailableStatus: [], }, { status: USER_STATES.ONBOARDING, @@ -51,11 +42,7 @@ export default class UserStatusComponent extends Component { { status: USER_STATES.DNE, message: `Your Status doesn't exist`, - otherAvailableStatus: [ - this.ALL_FEASIBLE_STATUS.ACTIVE, - this.ALL_FEASIBLE_STATUS.IDLE, - this.ALL_FEASIBLE_STATUS.OOO, - ], + otherAvailableStatus: [this.ALL_FEASIBLE_STATUS.OOO], }, ]; diff --git a/app/controllers/index.js b/app/controllers/index.js index 7f7f5d1c..0cae6926 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -25,7 +25,7 @@ export default class IndexController extends Controller { this.toggleUserStateModal(); } try { - await fetch(`${BASE_URL}/users/status/self`, { + await fetch(`${BASE_URL}/users/status/self?userStatusFlag=true`, { method: 'PATCH', body: JSON.stringify(newStatus), headers: { diff --git a/tests/integration/components/user-status-modal-test.js b/tests/integration/components/user-status-modal-test.js index a842d2d7..356c0786 100644 --- a/tests/integration/components/user-status-modal-test.js +++ b/tests/integration/components/user-status-modal-test.js @@ -88,43 +88,6 @@ module('Integration | Component | user-status-modal', function (hooks) { await click('.modal__submit'); }); - test('payload contains relevant data when status is changed to IDLE', async function (assert) { - this.setProperties({ - newStatus: 'IDLE', - showUserStateModal: true, - toggleUserStateModal: () => { - this.set('showUserStateModal', !this.showUserStateModal); - }, - updateStatus: (statusPayLoad) => { - const { - currentStatus: { state, from, message, updatedAt }, - } = statusPayLoad; - assert.equal(state, 'IDLE', 'new state present in the payload'); - assert.equal( - message, - 'Rust and GoLang', - 'message present in the payload' - ); - assert.ok(typeof from === 'number', 'from is a numeric timestamp'); - assert.ok( - typeof updatedAt === 'number', - 'updatedAt is a numeric timestamp' - ); - }, - }); - - await render(hbs` - `); - await fillIn('[data-test-textarea-reason]', 'Rust and GoLang'); - await click('.modal__submit'); - }); - test('modal is closed on click of close button', async function (assert) { this.setProperties({ newStatus: 'ACTIVE', diff --git a/tests/integration/components/user-status-test.js b/tests/integration/components/user-status-test.js new file mode 100644 index 00000000..dfa9d917 --- /dev/null +++ b/tests/integration/components/user-status-test.js @@ -0,0 +1,72 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | user-status', function (hooks) { + setupRenderingTest(hooks); + + test('show relevant data when status is ONBOARDING', async function (assert) { + this.setProperties({ + changeStatus: () => {}, + updateStatus: () => {}, + status: 'ONBOARDING', + isStatusUpdating: false, + }); + + await render(hbs` + + `); + + assert.dom('[data-test-onboarding-details]').exists(); + assert.dom('[data-test-status]').hasText('You are undergoing onboarding'); + }); + + test('show relevant data when status is IDLE', async function (assert) { + this.setProperties({ + changeStatus: () => {}, + updateStatus: () => {}, + status: 'IDLE', + isStatusUpdating: false, + }); + + await render(hbs` + + `); + + assert.dom('[data-test-status]').hasText(`You are Idle`); + assert + .dom('[data-test-update-status-OOO]') + .hasText('Change your status to OOO'); + }); + + test('show relevant data when status is OOO', async function (assert) { + this.setProperties({ + status: 'OOO', + isStatusUpdating: false, + changeStatus: () => {}, + updateStatus: () => {}, + }); + + await render(hbs` + + `); + + assert.dom('[data-test-status]').hasText(`You are OOO`); + }); +});
If you are not a developer, please contact Ankush for next steps.