fix typo in ticket template causing extraneous navLink to be displayed
[squeep-indie-auther] / test / src / template / admin-ticket-html.js
1 /* eslint-env mocha */
2 'use strict';
3
4 const assert = require('assert');
5 const template = require('../../../src/template/admin-ticket-html');
6 const Config = require('../../../config');
7 const StubLogger = require('../../stub-logger');
8 const { makeHtmlLint } = require('@squeep/html-template-helper');
9 const { HtmlValidate } = require('html-validate');
10
11 const stubLogger = new StubLogger();
12 const htmlValidate = new HtmlValidate();
13 const lintHtml = makeHtmlLint(stubLogger, htmlValidate);
14
15 describe('Admin Ticket HTML Template', function () {
16 let ctx, config;
17 beforeEach(function () {
18 ctx = {
19 profilesScopes: {
20 scopeIndex: {
21 'profile': {
22 application: '',
23 description: '',
24 isPermanent: true,
25 isManuallyAdded: false,
26 profiles: ['https://example.com/'],
27 },
28 'other_scope': {
29 application: 'app1',
30 description: '',
31 isPermanent: false,
32 isManuallyAdded: true,
33 profiles: [],
34 },
35 'read': {
36 application: 'app2',
37 description: '',
38 isPermanent: true,
39 isManuallyAdded: false,
40 profiles: [],
41 },
42 'scopitty_scope': {
43 application: 'app2',
44 description: '',
45 isPermanent: false,
46 isManuallyAdded: false,
47 profiles: [],
48 },
49 'last_scope': {
50 application: 'app1',
51 description: '',
52 isPermanent: false,
53 isManuallyAdded: false,
54 profiles: [],
55 },
56 },
57 profileScopes: {
58 'https://example.com': {
59 'profile': {
60 application: '',
61 description: '',
62 isPermanent: true,
63 isManuallyAdded: false,
64 profiles: ['https://example.com/'],
65 },
66 },
67 },
68 profiles: ['https://example.com/'],
69 },
70 };
71 config = new Config('test');
72 });
73 it('renders', async function () {
74 const result = template(ctx, config);
75 await lintHtml(result);
76 assert(result);
77 });
78 it('covers branches', async function () {
79 delete ctx.profilesScopes;
80 const result = template(ctx, config);
81 await lintHtml(result);
82 assert(result);
83 });
84 }); // Admin Ticket HTML Template