update devDependencies, update tests for new validator, fixes for validation issues
[squeep-indie-auther] / test / src / template / authorization-error-html.js
index ba92f30ed67c8367f35bee185dc9fbc3bda42a89..4858b51c8238e061b3d166d059262b7f6f009be6 100644 (file)
@@ -5,15 +5,12 @@ 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 { makeHtmlLint } = require('@squeep/html-template-helper');
+const { HtmlValidate } = require('html-validate');
 
 const stubLogger = new StubLogger();
-
-function lintHtml(html) {
-  const result = lint(html);
-  stubLogger.debug('validHtml', '', { result, html });
-  assert(!result);
-}
+const htmlValidate = new HtmlValidate();
+const lintHtml = makeHtmlLint(stubLogger, htmlValidate);
 
 describe('Authorization Error HTML Template', function () {
   let ctx, config;
@@ -21,18 +18,18 @@ describe('Authorization Error HTML Template', function () {
     ctx = {};
     config = new Config('test');
   });
-  it('renders', function () {
+  it('renders', async function () {
     const result = template(ctx, config);
-    lintHtml(result);
+    await lintHtml(result);
     assert(result);
   });
-  it('renders errors', function () {
+  it('renders errors', async function () {
     ctx.session = {
       error: 'error_name',
       errorDescriptions: ['something went wrong', 'another thing went wrong'],
     }
     const result = template(ctx, config);
-    lintHtml(result);
+    await lintHtml(result);
     assert(result);
   });
 }); // Authorization Error HTML Template