const assert = require('assert');
const { LoginHTML } = require('../../../lib/template');
-const stubLogger = require('../../stub-logger');
-const lint = require('html-minifier-lint').lint; // eslint-disable-line node/no-unpublished-require
-
-function lintHtml(html) {
- const result = lint(html);
- stubLogger.debug('validHtml', '', { result, html });
- assert(!result);
-}
+const lintHtml = require('../../lint-html');
describe('Template LoginHTML', function () {
let ctx, options;
};
options = {
authenticator: {
- authnEnabled: ['indieAuth', 'DEBUG_ANY'],
+ authnEnabled: ['indieAuth'],
secureAuthOnly: true,
},
manager: {
};
});
- it('covers', function () {
+ it('covers', async function () {
+ const result = LoginHTML(ctx, options);
+ await lintHtml(result);
+ assert(result);
+ });
+
+ it('covers local user', async function () {
+ options.authenticator.authnEnabled = ['argon2'];
const result = LoginHTML(ctx, options);
- lintHtml(result);
+ await lintHtml(result);
assert(result);
});
- it('renders errors and additional content', function () {
+ 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 = ['<p>This is a login page.</p>'];
options.authenticator.indieAuthBlurb = ['<p>Describe what IndieAuth allows one to do.</p>'];
options.authenticator.userBlurb = ['<p>Describe user login.</p>'];
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);
});