display history of topic updates on topic details page
[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 lintHtml = require('../../lint-html');
8
9 describe('Admin Topic Details HTML Template', function () {
10 let ctx, config;
11
12 beforeEach(function () {
13 ctx = {
14 params: {
15 topicId: '97dd5488-a303-11ec-97ab-0025905f714a',
16 },
17 topic: {},
18 subscriptions: [
19 {},
20 ],
21 };
22 config = new Config('test');
23 });
24
25 it('renders', function () {
26 const result = template(ctx, config);
27 lintHtml(result);
28 assert(result);
29 });
30 it('covers null topic', function () {
31 ctx.topic = null;
32 ctx.subscriptions = null;
33 const result = template(ctx, config);
34 lintHtml(result);
35 assert(result);
36 });
37 it('covers missing subscriptions', function () {
38 delete ctx.subscriptions;
39 const result = template(ctx, config);
40 lintHtml(result);
41 assert(result);
42 });
43 it('covers plural subscriptions', function () {
44 ctx.subscriptions = [{}, {}, {}];
45 const result = template(ctx, config);
46 lintHtml(result);
47 assert(result);
48 });
49 });