b599df346cf9d7d6d61cd032172cf6d1c73f3dff
4 const assert
= require('assert');
5 const template
= require('../../../src/template/authorization-request-html');
6 const Config
= require('../../../config');
7 const StubLogger
= require('../../stub-logger');
8 const lint
= require('html-minifier-lint').lint
; // eslint-disable-line node/no-unpublished-require
10 const stubLogger
= new StubLogger();
12 function lintHtml(html
) {
13 const result
= lint(html
);
14 stubLogger
.debug('validHtml', '', { result
, html
});
18 describe('Authorization Request HTML Template', function () {
20 beforeEach(function () {
22 config
= new Config('test');
24 it('renders', function () {
25 const result
= template(ctx
, config
);
29 it('covers options', function () {
31 scope: ['profile', 'email'],
34 description: 'Profile',
40 description: 'Create',
41 profiles: ['https://exmaple.com/profile'],
44 me: new URL('https://example.com/profile'),
45 profiles: ['https://another.example.com/profile', 'https://example.com/profile'],
49 url: 'https://client.example.com/app/',
50 summary: 'This is an app',
51 logo: 'https://client.example.com/app/logo.png',
52 name: 'Some Fancy Application',
56 clientId: 'https://client.example.com/app/',
57 persist: 'encodedData',
58 redirectUri: 'https://client.example.com/app/_return',
60 const result
= template(ctx
, config
);
64 it('covers alternate scopes and client logo', function () {
66 scope: ['profile', 'email'],
69 description: 'Profile',
75 description: 'Create',
76 profiles: ['https://example.com/profile'],
79 description: 'Another Scope',
80 profiles: ['https://example.com/profile'],
83 me: new URL('https://example.com/profile'),
84 profiles: ['https://another.example.com/profile', 'https://example.com/profile'],
88 url: 'https://client.example.com/app/',
89 summary: 'This is an app',
91 value: 'https://client.example.com/app/logo.png',
94 name: 'Some Fancy Application',
98 clientId: 'https://client.example.com/app/',
99 persist: 'encodedData',
100 redirectUri: 'https://client.example.com/app/_return',
102 const result
= template(ctx
, config
);
106 it('covers partial data', function () {
108 scope: ['profile', 'email', 'create'],
109 profiles: ['https://another.example.com/profile', 'https://example.com/profile'],
113 url: 'https://client.example.com/app/',
114 summary: 'This is an app',
115 logo: 'https://client.example.com/app/logo.png',
116 name: 'Some Fancy Application',
120 clientId: 'https://client.example.com/app/',
121 persist: 'encodedData',
122 redirectUri: 'https://client.example.com/app/_return',
124 const result
= template(ctx
, config
);
128 it('covers partial data', function () {
130 scope: ['profile', 'email', 'create'],
136 clientId: 'https://client.example.com/app/',
137 persist: 'encodedData',
138 redirectUri: 'https://client.example.com/app/_return',
140 const result
= template(ctx
, config
);
144 }); // Authorization Request HTML Template