X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Flib%2Ftemplate-helper.js;h=58985ccd962683f175f29a879a189d708b913335;hb=a2c0e2fc57bb8f25f694e16eb4e51d6970b28829;hp=a21b141eaeec7e37c3429fa9b1ea2d268fd4bbcc;hpb=5690ad318ed98cff45bf1fd192656a7156c7045c;p=squeep-html-template-helper diff --git a/test/lib/template-helper.js b/test/lib/template-helper.js index a21b141..58985cc 100644 --- a/test/lib/template-helper.js +++ b/test/lib/template-helper.js @@ -21,6 +21,16 @@ describe('Template Helper', function () { options = {}; }); + describe('initContext', function () { + it('covers', function () { + th.initContext(ctx); + assert(ctx.errors); + assert(ctx.notifications); + assert(Array.isArray(ctx.errors)); + assert(Array.isArray(ctx.notifications)); + }); + }); // initContext + describe('dateOrNot', function () { let date, otherwise; beforeEach(function () { @@ -83,6 +93,26 @@ describe('Template Helper', function () { }); }); // dateFormat + describe('timeElement', function () { + it('renders a date', function () { + const when = new Date('2022-09-11T21:17:56.872Z'); + const expected = ''; + const result = th.timeElement(when); + assert.strictEqual(result, expected); + }); + it('covers title', function () { + const when = new Date('2022-09-11T21:17:56.872Z'); + const expected = ''; + const result = th.timeElement(when, { title: 'a date' }); + assert.strictEqual(result, expected); + }); + it('covers other', function () { + const expected = ''; + const result = th.timeElement(1648420085049); + assert.strictEqual(result, expected); + }); + }); // timeElement + describe('secondsToPeriod', function () { it('covers seconds', function () { const result = th.secondsToPeriod(45); @@ -171,6 +201,13 @@ describe('Template Helper', function () { }); }); // LI + describe('indented', function () { + it('covers', function () { + const result = th.indented(2, ['foo', 'bar']); + result.forEach((r) => assert(r.startsWith('\t\t'))); + }); + }); // indented + describe('htmlBody', function () { it('covers no main', function () { const result = th.htmlBody(pagePathLevel, ctx, options);