add account settings page, rest of otp support, stdio credential helper, other misc
[squeep-authentication-module] / test / lib / template / settings-html.js
diff --git a/test/lib/template/settings-html.js b/test/lib/template/settings-html.js
new file mode 100644 (file)
index 0000000..858f1c2
--- /dev/null
@@ -0,0 +1,56 @@
+/* eslint-env mocha */
+'use strict';
+
+const assert = require('assert');
+const { SettingsHTML } = require('../../../lib/template');
+const stubLogger = require('../../stub-logger');
+const lintHtml = require('../../lint-html');
+
+describe('Template SettingsHTML', function () {
+  let ctx, options;
+  beforeEach(function () {
+    ctx = {};
+    options = {
+      authenticator: {
+        otpBlurb: ['otp info'],
+      },
+      manager: {
+        pageTitle: 'page',
+      },
+      dingus: {
+        selfBaseUrl: 'https://example.com/',
+      },
+    };
+  });
+
+  it('renders, no otp', async function () {
+    ctx.errors = ['an error', 'another error'];
+    ctx.notifications = ['a notice']
+    const result = SettingsHTML(ctx, options);
+    await lintHtml(result);
+    assert(result);
+  });
+
+  it('covers, otp', async function () {
+    ctx.otpKey = '1234567890123456789012';
+    const result = SettingsHTML(ctx, options);
+    await lintHtml(result);
+    assert(result);
+  });
+
+  it('covers, otp confirm', async function () {
+    ctx.otpConfirmKey = '1234567890123456789012';
+    ctx.otpConfirmBox = 'boxboxbox';
+    ctx.authenticationId = 'identifier';
+    const result = SettingsHTML(ctx, options);
+    await lintHtml(result);
+    assert(result);
+  });
+
+  it('covers empty error', async function () {
+    const result = SettingsHTML(ctx, options);
+    await lintHtml(result);
+    assert(result);
+  });
+
+});