update devDependencies, clean up lint issues
[squeep-authentication-module] / test / lib / template / settings-html.js
1 'use strict';
2
3 const assert = require('node:assert');
4 const { SettingsHTML } = require('../../../lib/template');
5 const lintHtml = require('../../lint-html');
6
7 describe('Template SettingsHTML', function () {
8 let ctx, options;
9 beforeEach(function () {
10 ctx = {};
11 options = {
12 authenticator: {
13 otpBlurb: ['otp info'],
14 },
15 manager: {
16 pageTitle: 'page',
17 },
18 dingus: {
19 selfBaseUrl: 'https://example.com/',
20 },
21 };
22 });
23
24 it('renders, no otp', async function () {
25 ctx.errors = ['an error', 'another error'];
26 ctx.notifications = ['a notice'];
27 const result = SettingsHTML(ctx, options);
28 await lintHtml(result);
29 assert(result);
30 });
31
32 it('covers, otp', async function () {
33 ctx.otpKey = '1234567890123456789012';
34 const result = SettingsHTML(ctx, options);
35 await lintHtml(result);
36 assert(result);
37 });
38
39 it('covers, otp confirm', async function () {
40 ctx.otpConfirmKey = '1234567890123456789012';
41 ctx.otpConfirmBox = 'boxboxbox';
42 ctx.authenticationId = 'identifier';
43 const result = SettingsHTML(ctx, options);
44 await lintHtml(result);
45 assert(result);
46 });
47
48 it('covers empty error', async function () {
49 const result = SettingsHTML(ctx, options);
50 await lintHtml(result);
51 assert(result);
52 });
53
54 });