X-Git-Url: http://git.squeep.com/?p=websub-hub;a=blobdiff_plain;f=test%2Fsrc%2Fmanager.js;h=cbd83243d3faecabdf8d77667151a230ac180f88;hp=67283d76b82c992058e39b2926bd699cd1d43830;hb=737fbd003d5c4dfea81b667ef906f1c106a60612;hpb=17b4ff9c1974842c02071d2cd02144d2e5a99eb5 diff --git a/test/src/manager.js b/test/src/manager.js index 67283d7..cbd8324 100644 --- a/test/src/manager.js +++ b/test/src/manager.js @@ -33,6 +33,7 @@ describe('Manager', function () { }; ctx = { params: {}, + queryParams: {}, }; manager = new Manager(stubLogger, stubDb, options); sinon.stub(manager.communication, 'verificationProcess'); @@ -137,6 +138,31 @@ describe('Manager', function () { }); }); // getInfo + describe('_historyBarCaption', function () { + it('covers today, none', function () { + const result = Manager._historyBarCaption(0, 0); + assert.strictEqual(result, 'today, no updates'); + }); + it('covers yesterday, singular', function () { + const result = Manager._historyBarCaption(1, 1); + assert.strictEqual(result, 'yesterday, 1 update'); + }); + it('covers older, plural', function () { + const result = Manager._historyBarCaption(7, 3); + assert.strictEqual(result, '7 days ago, 3 updates'); + }); + }); // _historyBarCaption + + describe('getHistorySVG', function () { + beforeEach(function () { + manager.db.topicPublishHistory.resolves([0, 1, 2, 1, 0, 1, 2, 0, 1]); + }); + it('covers', async function () { + await manager.getHistorySVG(res, ctx); + assert(res.end.called); + }); + }); // getHistorySVG + describe('getAdminOverview', function () { beforeEach(function () { manager.db.topicGetAll.resolves([ @@ -212,6 +238,7 @@ describe('Manager', function () { deliveryAttemptsSinceSuccess: 0, deliveryNextAttempt: new Date(-Infinity), }]); + manager.db.topicPublishHistory.resolves([0, 1, 0, 1, 0]); }); it('covers', async function() { await manager.getTopicDetails(res, ctx);