3 const assert
= require('node:assert');
4 const { LoginHTML
} = require('../../../lib/template');
5 const lintHtml
= require('../../lint-html');
7 describe('Template LoginHTML', function () {
9 beforeEach(function () {
11 clientProtocol: 'https',
15 authnEnabled: ['indieAuth'],
22 selfBaseUrl: 'https://example.com/',
27 it('covers', async
function () {
28 const result
= LoginHTML(ctx
, options
);
29 await
lintHtml(result
);
33 it('covers local user', async
function () {
34 options
.authenticator
.authnEnabled
= ['argon2'];
35 const result
= LoginHTML(ctx
, options
);
36 await
lintHtml(result
);
40 it('renders errors and additional content', async
function () {
41 ctx
.errors
= ['an error', 'another error'];
42 options
.manager
.logoUrl
= 'https://example.com/logo.png';
43 options
.authenticator
.loginBlurb
= ['<p>This is a login page.</p>'];
44 options
.authenticator
.indieAuthBlurb
= ['<p>Describe what IndieAuth allows one to do.</p>'];
45 options
.authenticator
.userBlurb
= ['<p>Describe user login.</p>'];
46 const result
= LoginHTML(ctx
, options
);
47 await
lintHtml(result
);
51 it('covers no indieAuth', async
function () {
52 options
.authenticator
.authnEnabled
= [];
53 const result
= LoginHTML(ctx
, options
);
54 await
lintHtml(result
);
58 it('covers insecure not allowed', async
function () {
59 ctx
.clientProtocol
= undefined;
60 const result
= LoginHTML(ctx
, options
);
61 await
lintHtml(result
);
65 it('covers insecure allowed', async
function () {
66 ctx
.clientProtocol
= 'http';
67 options
.authenticator
.secureAuthOnly
= false;
68 const result
= LoginHTML(ctx
, options
);
69 await
lintHtml(result
);