|
1 | 1 | import { hbs } from 'ember-cli-htmlbars'; |
2 | 2 | import { module, test } from 'qunit'; |
3 | | -import EmberObject from '@ember/object'; |
4 | 3 | import { setupIntegrationTest } from 'open-event-frontend/tests/helpers/setup-integration-test'; |
5 | 4 | import { render } from '@ember/test-helpers'; |
6 | 5 |
|
7 | 6 | module('Integration | Component | unverified user message', function(hooks) { |
8 | 7 | setupIntegrationTest(hooks); |
9 | 8 |
|
10 | | - test('it renders', async function(assert) { |
11 | | - this.set('shouldShowMessage', true); |
| 9 | + function setShouldShowMessage(sessionExtra = {}) { |
| 10 | + this.set('session', { |
| 11 | + isAuthenticated: true, |
| 12 | + ...sessionExtra |
| 13 | + }); |
| 14 | + this.set('authManager', { |
| 15 | + currentUser: { |
| 16 | + isVerified: false |
| 17 | + } |
| 18 | + }); |
| 19 | + } |
| 20 | + |
| 21 | + test('confirmation mail sent', async function(assert) { |
| 22 | + setShouldShowMessage.call(this); |
12 | 23 | this.set('isMailSent', true); |
13 | | - await render(hbs`{{unverified-user-message shouldShowMessage=shouldShowMessage isMailSent=isMailSent}}`); |
| 24 | + await render(hbs`{{unverified-user-message isMailSent=isMailSent authManager=authManager session=session}}`); |
14 | 25 | assert.ok(this.element.innerHTML.trim().includes('Confirmation mail has been sent again successfully')); |
15 | 26 | }); |
16 | 27 |
|
17 | | - test('it renders', async function(assert) { |
18 | | - |
19 | | - let session = EmberObject.create({ |
| 28 | + test('event live message', async function(assert) { |
| 29 | + setShouldShowMessage.call(this, { |
20 | 30 | currentRouteName: 'events.view.index' |
21 | 31 | }); |
22 | | - |
23 | | - this.set('shouldShowMessage', true); |
24 | 32 | this.set('isMailSent', false); |
25 | | - this.set('session', session); |
26 | | - await render(hbs`{{unverified-user-message shouldShowMessage=shouldShowMessage session=session isMailSent=isMailSent}}`); |
| 33 | + await render(hbs`{{unverified-user-message session=session authManager=authManager isMailSent=isMailSent}}`); |
27 | 34 | assert.ok(this.element.innerHTML.trim().includes('To make your event live, please verify your account by clicking on the confirmation link that has been emailed to you.')); |
28 | 35 | }); |
29 | 36 |
|
30 | | - test('it renders', async function(assert) { |
31 | | - |
32 | | - let session = EmberObject.create({ |
| 37 | + test('unverified message', async function(assert) { |
| 38 | + setShouldShowMessage.call(this, { |
33 | 39 | currentRouteName: 'else' |
34 | 40 | }); |
35 | | - |
36 | | - this.set('shouldShowMessage', true); |
37 | 41 | this.set('isMailSent', false); |
38 | | - this.set('session', session); |
39 | | - await render(hbs`{{unverified-user-message shouldShowMessage=shouldShowMessage session=session isMailSent=isMailSent}}`); |
| 42 | + await render(hbs`{{unverified-user-message session=session authManager=authManager isMailSent=isMailSent}}`); |
40 | 43 | assert.ok(this.element.innerHTML.trim().includes('Your account is unverified. Please verify by clicking on the confirmation link that has been emailed to you.')); |
41 | 44 | }); |
42 | 45 | }); |
0 commit comments