4 const assert
= require('node:assert');
5 const th
= require('../../../src/template/template-helper');
7 describe('Template Helper', function () {
9 describe('renderTopicRow', function () {
10 let topic
, subscribers
;
11 beforeEach(function () {
15 it('covers', function () {
16 const result
= th
.renderTopicRow(topic
, subscribers
);
19 it('covers empty', function () {
22 const result
= th
.renderTopicRow(topic
, subscribers
);
25 it('covers no link', function () {
26 subscribers
= [{}, {}];
27 const result
= th
.renderTopicRow(topic
, subscribers
, false);
30 it('covers validation', function () {
31 topic
.publisherValidationUrl
= 'https://example.com/';
32 const result
= th
.renderTopicRow(topic
, subscribers
, false);
37 describe('renderTopicRowHeader', function () {
38 it('covers', function () {
39 const result
= th
.renderTopicRowHeader();
42 }); // renderTopicRowHeader
44 describe('renderSubscriptionRow', function () {
46 beforeEach(function () {
49 it('covers', function () {
50 const result
= th
.renderSubscriptionRow(subscription
);
53 it('covers empty', function () {
54 const result
= th
.renderSubscriptionRow();
57 }); // renderSubscriptionRow
59 describe('renderSubscriptionRowHeader', function () {
60 it('covers', function () {
61 const result
= th
.renderSubscriptionRowHeader();
64 }); // renderSubscriptionRowHeader
66 describe('xmlEscape', function () {
67 it('ignores numbers', function () {
68 const result
= th
.xmlEscape(3);
69 assert
.strictEqual(result
, 3);
71 it('ignores objects', function () {
72 const result
= th
.xmlEscape({});
73 assert
.strictEqual(result
, undefined);
75 it('escapes a thing', function () {
76 const result
= th
.xmlEscape('&');
77 assert
.strictEqual(result
, '&');