Skip to content

Commit 593b203

Browse files
committed
test(docs-service): write acceptance test for docs service
1 parent 9f3dbe7 commit 593b203

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

frontend/app/components/topnav.hbs

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
title="Timed Documentation Of This Page"
9595
href={{this.docs.docsEndpoint}}
9696
target="_blank"
97+
data-test-docs-link
9798
>
9899
<FaIcon @icon="info-circle" @prefix="fa" />
99100
Docs
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { visit } from "@ember/test-helpers";
2+
import { setupMirage } from "ember-cli-mirage/test-support";
3+
import { setupApplicationTest } from "ember-qunit";
4+
import { authenticateSession } from "ember-simple-auth/test-support";
5+
import { module, test } from "qunit";
6+
7+
import config from "timed/config/environment";
8+
9+
module("Acceptance | docs", function (hooks) {
10+
setupApplicationTest(hooks);
11+
setupMirage(hooks);
12+
13+
hooks.beforeEach(async function () {
14+
const user = this.server.create("user", { tourDone: true });
15+
16+
await authenticateSession({ user_id: user.id });
17+
});
18+
19+
test("Each route render link to the documentation of the open page", async function (assert) {
20+
await visit("/");
21+
assert.dom("[data-test-docs-link]").exists();
22+
23+
assert.strictEqual(
24+
document.querySelector("[data-test-docs-link]").href,
25+
`${config.docsBaseUrl}tracking/activities`,
26+
);
27+
28+
await visit("/analysis");
29+
30+
assert.strictEqual(
31+
document.querySelector("[data-test-docs-link]").href,
32+
`${config.docsBaseUrl}analysis`,
33+
);
34+
});
35+
});

0 commit comments

Comments
 (0)