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