display history of topic updates on topic details page
[websub-hub] / test / src / db / postgres.js
index da071f2ab28566b53b73ba3ff25858c7e96e0355..626b0c2573a145f1727e6cc5e099e06e16d1cdc1 100644 (file)
@@ -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 () {