X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Flib%2Ftemplate%2Flogin-html.js;h=40ecc4b1de0499ea782086324c6c0bb9c0dbe329;hb=04c85a23b032c46ac0e5a1d85db34b9a7560c216;hp=6bf0b8fa5c47fd420269d6274d1d280d8a9f2c9a;hpb=1e2d8a7bdb0df28d08258ee813ee6db77168d59e;p=squeep-authentication-module diff --git a/test/lib/template/login-html.js b/test/lib/template/login-html.js index 6bf0b8f..40ecc4b 100644 --- a/test/lib/template/login-html.js +++ b/test/lib/template/login-html.js @@ -1,7 +1,6 @@ -/* eslint-env mocha */ 'use strict'; -const assert = require('assert'); +const assert = require('node:assert'); const { LoginHTML } = require('../../../lib/template'); const lintHtml = require('../../lint-html'); @@ -13,7 +12,7 @@ describe('Template LoginHTML', function () { }; options = { authenticator: { - authnEnabled: ['indieAuth', 'DEBUG_ANY'], + authnEnabled: ['indieAuth'], secureAuthOnly: true, }, manager: { @@ -25,42 +24,49 @@ describe('Template LoginHTML', function () { }; }); - it('covers', function () { + it('covers', async function () { const result = LoginHTML(ctx, options); - lintHtml(result); + await lintHtml(result); assert(result); }); - it('renders errors and additional content', function () { + it('covers local user', async function () { + options.authenticator.authnEnabled = ['argon2']; + const result = LoginHTML(ctx, options); + await lintHtml(result); + assert(result); + }); + + it('renders errors and additional content', async function () { ctx.errors = ['an error', 'another error']; options.manager.logoUrl = 'https://example.com/logo.png'; options.authenticator.loginBlurb = ['

This is a login page.

']; options.authenticator.indieAuthBlurb = ['

Describe what IndieAuth allows one to do.

']; options.authenticator.userBlurb = ['

Describe user login.

']; const result = LoginHTML(ctx, options); - lintHtml(result); + await lintHtml(result); assert(result); }); - it('covers no indieAuth', function () { + it('covers no indieAuth', async function () { options.authenticator.authnEnabled = []; const result = LoginHTML(ctx, options); - lintHtml(result); + await lintHtml(result); assert(result); }); - it('covers insecure not allowed', function () { + it('covers insecure not allowed', async function () { ctx.clientProtocol = undefined; const result = LoginHTML(ctx, options); - lintHtml(result); + await lintHtml(result); assert(result); }); - it('covers insecure allowed', function () { + it('covers insecure allowed', async function () { ctx.clientProtocol = 'http'; options.authenticator.secureAuthOnly = false; const result = LoginHTML(ctx, options); - lintHtml(result); + await lintHtml(result); assert(result); });