Skip to content

Commit 3504b16

Browse files
mrsaicharan1niranjan94
authored andcommitted
Used mixing for billing route access
ESLint and integration tests fix
1 parent 9d74726 commit 3504b16

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

app/routes/account/billing-info.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import Route from '@ember/routing/route';
2+
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
23

3-
export default Route.extend({
4+
export default Route.extend(AuthenticatedRouteMixin, {
5+
titleToken() {
6+
return this.l10n.t('Billing Info');
7+
}
48
});

tests/acceptance/billing-info-test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
import { module, test } from 'qunit';
22
import { setupApplicationTest } from 'ember-qunit';
33
import { currentURL, visit } from '@ember/test-helpers';
4+
import { login } from 'open-event-frontend/tests/helpers/custom-helpers';
45

56

67
module('Acceptance | account/billing-info', function(hooks) {
78
setupApplicationTest(hooks);
89

910

10-
test('visiting account/billing-info', async function(assert) {
11+
test('visiting account/billing-info without login', async function(assert) {
12+
await visit('account/billing-info');
13+
assert.equal(currentURL(), '/login');
14+
});
15+
16+
test('visiting account/billing-info with login', async function(assert) {
17+
await login(assert);
1118
await visit('account/billing-info');
1219
assert.equal(currentURL(), 'account/billing-info');
1320
});

tests/acceptance/invoices-test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
import { module, test } from 'qunit';
22
import { setupApplicationTest } from 'ember-qunit';
33
import { currentURL, visit } from '@ember/test-helpers';
4+
import { login } from 'open-event-frontend/tests/helpers/custom-helpers';
45

56

67
module('Acceptance | account/billing-info/invoices', function(hooks) {
78
setupApplicationTest(hooks);
89

910

10-
test('visiting account/billing-info/invoices login', async function(assert) {
11+
test('visiting account/billing-info/invoices without login', async function(assert) {
1112
await visit('account/billing-info/invoices');
12-
assert.equal(currentURL(), 'account/billing-info/invoices');
13+
assert.equal(currentURL(), '/login');
14+
});
15+
16+
test('visiting account/billing-info/invoices with login', async function(assert) {
17+
await login(assert);
18+
await visit('/account/billing-info/invoices');
19+
assert.equal(currentURL(), '/account/billing-info/invoices');
1320
});
1421
});

tests/acceptance/payment-info-test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
import { module, test } from 'qunit';
22
import { setupApplicationTest } from 'ember-qunit';
33
import { currentURL, visit } from '@ember/test-helpers';
4+
import { login } from 'open-event-frontend/tests/helpers/custom-helpers';
45

56

67
module('Acceptance | account/billing-info/payment-info', function(hooks) {
78
setupApplicationTest(hooks);
89

910

10-
test('visiting account/billing-info/payment-info', async function(assert) {
11+
test('visiting account/billing-info/payment-info without login', async function(assert) {
1112
await visit('account/billing-info/payment-info');
12-
assert.equal(currentURL(), 'account/billing-info/payment-info');
13+
assert.equal(currentURL(), '/login');
14+
});
15+
16+
test('visiting account/billing-info/payment-info with login', async function(assert) {
17+
await login(assert);
18+
await visit('/account/billing-info/payment-info');
19+
assert.equal(currentURL(), '/account/billing-info/payment-info');
1320
});
1421
});

0 commit comments

Comments
 (0)