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