update dependencies and devDependencies, fix pg-promise breaking changes
[websub-hub] / test / src / db / postgres.js
index da071f2ab28566b53b73ba3ff25858c7e96e0355..d6bf6746524e88275078233d041195b356d4f966 100644 (file)
@@ -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 () {