X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fsrc%2Fdb%2Fpostgres.js;h=d6bf6746524e88275078233d041195b356d4f966;hb=92661d6fa967999e7e12e86a2f4d5ce314a02c9b;hp=da071f2ab28566b53b73ba3ff25858c7e96e0355;hpb=33897b863a84ff7d248888f83dc100a96cd9bc49;p=websub-hub diff --git a/test/src/db/postgres.js b/test/src/db/postgres.js index da071f2..d6bf674 100644 --- a/test/src/db/postgres.js +++ b/test/src/db/postgres.js @@ -141,7 +141,7 @@ describe('DatabasePostgres', function () { columnTwo: 4, }, ]; - db.pgpInitOptions.receive(data, result, event) + db.pgpInitOptions.receive({ data, result, ctx: event }); assert(db.logger.debug.called); assert.deepStrictEqual(data, expectedData); }); @@ -170,7 +170,7 @@ describe('DatabasePostgres', function () { columnTwo: 4, }, ]; - db.pgpInitOptions.receive(data, result, event) + db.pgpInitOptions.receive({ data, result, ctx: event }); assert(!db.logger.debug.called); assert.deepStrictEqual(data, expectedData); }); @@ -1322,6 +1322,21 @@ describe('DatabasePostgres', function () { }); }); + describe('topicPublishHistory', function () { + beforeEach(function () { + sinon.stub(db.db, 'manyOrNone'); + }); + it('success', async function () { + db.db.manyOrNone.returns([ + { daysAgo: 1, contentUpdates: 1 }, + { daysAgo: 3, contentUpdates: 2 }, + ]); + const result = await db.topicPublishHistory(dbCtx, topicId, 7); + const expected = [0, 1, 0, 2, 0, 0, 0]; + assert.deepStrictEqual(result, expected); + }); + }); // topicPublishHistory + describe('topicSet', function () { let data; beforeEach(function () {