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