@@ -5,6 +5,7 @@ import { authenticateSession } from "ember-simple-auth/test-support";
5
5
import { module , test } from "qunit" ;
6
6
7
7
import config from "timed/config/environment" ;
8
+ import { ROUTE_DOCS_MAPPING } from "timed/services/docs" ;
8
9
9
10
module ( "Acceptance | docs" , function ( hooks ) {
10
11
setupApplicationTest ( hooks ) ;
@@ -17,25 +18,18 @@ module("Acceptance | docs", function (hooks) {
17
18
} ) ;
18
19
19
20
test ( "Each route renders a link to the corresponding documentation page" , async function ( assert ) {
20
- const routes = {
21
- "/attendances" : "tracking/attendances" ,
22
- "/reports" : "tracking/timesheet" ,
23
- "/analysis" : "analysis" ,
24
- "/statistics" : "statistics" ,
25
- "/projects" : "projects" ,
26
- "/users" : "users" ,
27
- "/" : "tracking/activities" ,
28
- } ;
29
- const routesKey = Object . keys ( routes ) ;
21
+ const routesKey = Object . keys ( ROUTE_DOCS_MAPPING ) ;
22
+ const router = this . owner . lookup ( "service:router" ) ;
30
23
31
24
for ( const routeKey of routesKey ) {
25
+ if ( routeKey === "users.edit.index" ) continue ;
32
26
// eslint-disable-next-line no-await-in-loop
33
- await visit ( routeKey ) ;
27
+ await visit ( router . urlFor ( routeKey ) ) ;
34
28
assert . dom ( "[data-test-docs-link]" ) . exists ( ) ;
35
29
36
30
assert . strictEqual (
37
31
document . querySelector ( "[data-test-docs-link]" ) . href ,
38
- `${ config . docsBaseUrl } / ${ routes [ routeKey ] } ` ,
32
+ `${ config . docsBaseUrl } ${ ROUTE_DOCS_MAPPING [ routeKey ] } ` ,
39
33
) ;
40
34
}
41
35
} ) ;
0 commit comments