X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=test%2Fsrc%2Ftemplate%2Fauthorization-error-html.js;fp=test%2Fsrc%2Ftemplate%2Fauthorization-error-html.js;h=ba92f30ed67c8367f35bee185dc9fbc3bda42a89;hp=0000000000000000000000000000000000000000;hb=b0103b0d496262c438b40bc20304081dbfe41e73;hpb=8ed81748bce7cea7904cac7225b20a60cafdfc16 diff --git a/test/src/template/authorization-error-html.js b/test/src/template/authorization-error-html.js new file mode 100644 index 0000000..ba92f30 --- /dev/null +++ b/test/src/template/authorization-error-html.js @@ -0,0 +1,38 @@ +/* eslint-env mocha */ +'use strict'; + +const assert = require('assert'); +const template = require('../../../src/template/authorization-error-html'); +const Config = require('../../../config'); +const StubLogger = require('../../stub-logger'); +const lint = require('html-minifier-lint').lint; // eslint-disable-line node/no-unpublished-require + +const stubLogger = new StubLogger(); + +function lintHtml(html) { + const result = lint(html); + stubLogger.debug('validHtml', '', { result, html }); + assert(!result); +} + +describe('Authorization Error HTML Template', function () { + let ctx, config; + beforeEach(function () { + ctx = {}; + config = new Config('test'); + }); + it('renders', function () { + const result = template(ctx, config); + lintHtml(result); + assert(result); + }); + it('renders errors', function () { + ctx.session = { + error: 'error_name', + errorDescriptions: ['something went wrong', 'another thing went wrong'], + } + const result = template(ctx, config); + lintHtml(result); + assert(result); + }); +}); // Authorization Error HTML Template