X-Git-Url: http://git.squeep.com/?p=websub-hub;a=blobdiff_plain;f=test%2Fsrc%2Ftemplate%2Ftemplate-helper.js;fp=test%2Fsrc%2Ftemplate%2Ftemplate-helper.js;h=3ad7f83812a3c3c8c5f46b7e32360837c059f338;hp=4ddf36060cb85592d6a3f5816d0ad0356f84ea3e;hb=d0444b4b0ee8166d911e6b227218d110eb7eddf1;hpb=728dc0686aa5282e7fc9473c92fbbc617a2b93d7 diff --git a/test/src/template/template-helper.js b/test/src/template/template-helper.js index 4ddf360..3ad7f83 100644 --- a/test/src/template/template-helper.js +++ b/test/src/template/template-helper.js @@ -75,6 +75,12 @@ describe('Template Helper', function () { const result = th.renderTopicRow(topic, subscribers); assert(result); }); + it('covers empty', function () { + topic = null; + subscribers = null; + const result = th.renderTopicRow(topic, subscribers); + assert(result); + }); it('covers no link', function () { subscribers = [{}, {}]; const result = th.renderTopicRow(topic, subscribers, false); @@ -103,6 +109,10 @@ describe('Template Helper', function () { const result = th.renderSubscriptionRow(subscription); assert(result); }); + it('covers empty', function () { + const result = th.renderSubscriptionRow(); + assert(result); + }); }); // renderSubscriptionRow describe('renderSubscriptionRowHeader', function () { @@ -179,6 +189,10 @@ describe('Template Helper', function () { describe('htmlFooter', function () { it('covers', function () { + const result = th.htmlFooter(['foo', 'bar']); + assert(result); + }); + it('covers default', function () { const result = th.htmlFooter(); assert(result); }); @@ -187,6 +201,7 @@ describe('Template Helper', function () { describe('htmlTemplate', function () { let pagePathLevel, pageTitle, headElements, navLinks, main; beforeEach(function () { + ctx = {}; pagePathLevel = 1; pageTitle = 'title'; headElements = []; @@ -194,11 +209,26 @@ describe('Template Helper', function () { main = []; }); it('covers', function () { - const result = th.htmlTemplate(pagePathLevel, pageTitle, headElements, navLinks, main); + const result = th.htmlTemplate(ctx, pagePathLevel, pageTitle, headElements, navLinks, main); assert(result); }); it('covers defaults', function () { - const result = th.htmlTemplate(pagePathLevel, pageTitle); + const result = th.htmlTemplate(ctx, pagePathLevel, pageTitle); + assert(result); + }); + it('covers user', function () { + ctx.session = { + authenticatedProfile: 'user', + }; + const result = th.htmlTemplate(ctx, pagePathLevel, pageTitle); + assert(result); + }); + it('covers user at root path', function () { + ctx.session = { + authenticatedIdentifier: 'user', + }; + pagePathLevel = 0; + const result = th.htmlTemplate(ctx, pagePathLevel, pageTitle); assert(result); }); }); // htmlTemplate