IndieAuth login support, allows viewing of topics related to profile
[websub-hub] / test / src / template / admin-topic-details-html.js
1 /* eslint-env mocha */
2 'use strict';
3
4 const assert = require('assert');
5 const template = require('../../../src/template/admin-topic-details-html');
6 const Config = require('../../../config');
7 const config = new Config('test');
8
9 describe('Admin Topic Details HTML Template', function () {
10 let ctx;
11
12 beforeEach(function () {
13 ctx = {
14 topic: {},
15 subscriptions: [
16 {},
17 ],
18 };
19 });
20
21 it('renders', function () {
22 const result = template(ctx, config);
23 assert(result);
24 });
25 it('covers null topic', function () {
26 ctx.topic = null;
27 ctx.subscriptions = null;
28 const result = template(ctx, config);
29 assert(result);
30 });
31 it('covers missing subscriptions', function () {
32 delete ctx.subscriptions;
33 const result = template(ctx, config);
34 assert(result);
35 });
36 it('covers plural subscriptions', function () {
37 ctx.subscriptions = [{}, {}, {}];
38 const result = template(ctx, config);
39 assert(result);
40 });
41 });