Skip to content

Commit

Permalink
Merge pull request #7360 from stopfstedt/backlink
Browse files Browse the repository at this point in the history
adds test coverage to ensure that back-to links are not present on events pages.
  • Loading branch information
dartajax authored Aug 30, 2023
2 parents 6a90392 + 54e2da5 commit 7a9702b
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/acceptance/events-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { module, test } from 'qunit';
import { setupAuthentication } from 'ilios-common';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { currentURL } from '@ember/test-helpers';
import page from 'ilios-common/page-objects/events';
import { DateTime } from 'luxon';

module('Acceptance | Event', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);

hooks.beforeEach(async function () {
this.school = this.server.create('school');
this.user = await setupAuthentication({ school: this.school });
});

test('back link is not visible', async function (assert) {
const date = DateTime.fromISO('2023-04-23');
const slug = 'U' + date.toFormat('yyyyMMdd') + 'O12345';
this.server.get(`/api/userevents/:userid`, () => {
return {
userEvents: [
{
offering: 1,
startDate: '2023-04-23',
prerequisites: [],
postrequisites: [],
},
],
};
});
await page.visit({ slug });
assert.strictEqual(currentURL(), `/events/${slug}`);
assert.notOk(page.backLink.isPresent);
});
});
19 changes: 19 additions & 0 deletions tests/acceptance/weeklyevents-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { module, test } from 'qunit';
import { setupAuthentication } from 'ilios-common';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import page from 'ilios-common/page-objects/weeklyevents';

module('Acceptance | Weekly events', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);

hooks.beforeEach(async function () {
this.user = await setupAuthentication();
});

test('back link is not visible', async function (assert) {
await page.visit();
assert.notOk(page.backLink.isPresent);
});
});

0 comments on commit 7a9702b

Please sign in to comment.