cdfcc0d4247ec94d83503bad3cdef076736332d6
[squeep-authentication-module] / test / lib / template / otp-html.js
1 'use strict';
2
3 const assert = require('node:assert');
4 const { OTPHTML } = require('../../../lib/template');
5 const lintHtml = require('../../lint-html');
6
7 describe('Template OTPHTML', 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', async function () {
25 ctx.errors = ['an error', 'another error'];
26 const result = OTPHTML(ctx, options);
27 await lintHtml(result);
28 assert(result);
29 });
30
31 it('covers empty error', async function () {
32 delete options.authenticator.otpBlurb;
33 const result = OTPHTML(ctx, options);
34 await lintHtml(result);
35 assert(result);
36 });
37
38 });