X-Git-Url: https://git.squeep.com/?p=squeep-authentication-module;a=blobdiff_plain;f=test%2Flib%2Ftemplate%2Fsettings-html.js;fp=test%2Flib%2Ftemplate%2Fsettings-html.js;h=858f1c22435264a0f60d8e4ce9455e444812d2dd;hp=0000000000000000000000000000000000000000;hb=53ef948ea83106e82d55e60d6695a15e94bf725e;hpb=842a3da269de1ab82e9a2a12aae8ed5677f064d8 diff --git a/test/lib/template/settings-html.js b/test/lib/template/settings-html.js new file mode 100644 index 0000000..858f1c2 --- /dev/null +++ b/test/lib/template/settings-html.js @@ -0,0 +1,56 @@ +/* eslint-env mocha */ +'use strict'; + +const assert = require('assert'); +const { SettingsHTML } = require('../../../lib/template'); +const stubLogger = require('../../stub-logger'); +const lintHtml = require('../../lint-html'); + +describe('Template SettingsHTML', function () { + let ctx, options; + beforeEach(function () { + ctx = {}; + options = { + authenticator: { + otpBlurb: ['otp info'], + }, + manager: { + pageTitle: 'page', + }, + dingus: { + selfBaseUrl: 'https://example.com/', + }, + }; + }); + + it('renders, no otp', async function () { + ctx.errors = ['an error', 'another error']; + ctx.notifications = ['a notice'] + const result = SettingsHTML(ctx, options); + await lintHtml(result); + assert(result); + }); + + it('covers, otp', async function () { + ctx.otpKey = '1234567890123456789012'; + const result = SettingsHTML(ctx, options); + await lintHtml(result); + assert(result); + }); + + it('covers, otp confirm', async function () { + ctx.otpConfirmKey = '1234567890123456789012'; + ctx.otpConfirmBox = 'boxboxbox'; + ctx.authenticationId = 'identifier'; + const result = SettingsHTML(ctx, options); + await lintHtml(result); + assert(result); + }); + + it('covers empty error', async function () { + const result = SettingsHTML(ctx, options); + await lintHtml(result); + assert(result); + }); + +});