forked from ember-learn/guides-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathside-bar-links-test.js
38 lines (30 loc) · 934 Bytes
/
side-bar-links-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { module, test } from 'qunit';
async function visitPages(pages, assert) {
for (let page of pages) {
const { pages, skipToc, title, url } = page;
if (skipToc) {
continue;
}
if (pages) {
await visitPages(pages, assert);
} else {
await visit(`/release/${url}`);
assert.dom('h1').hasText(title, 'We see the correct title in h1 tag.');
}
}
}
module('Acceptance | side bar links', function (hooks) {
setupApplicationTest(hooks);
test('release links go to correct page', async function (assert) {
assert.expect(131);
await visit('/release');
let store = this.owner.lookup('service:store');
let pages = await store.peekAll('page');
await visitPages(
pages.toArray().filter((page) => !page.id.includes('toc-heading')),
assert
);
});
});