lint cleanup
[websub-hub] / test / src / db / sqlite.js
index be6399445bcb01279ca2c2b9392c58cbf94e934c..e466930f197d533ab6a39ccc166683c3fcd0a3d6 100644 (file)
@@ -237,7 +237,7 @@ describe('DatabaseSQLite', function () {
         contentFetchNextAttempt: now,
         contentUpdated: now,
         url: topic.url,
-      }
+      };
       const result = DB._topicDataToNative(topic);
       assert.deepStrictEqual(result, expected);
     });
@@ -460,7 +460,7 @@ describe('DatabaseSQLite', function () {
         assert.deepStrictEqual(e, expected);
       }
     });
-  });
+  }); // subscriptionDeleteExpired
 
   describe('subscriptionDeliveryClaim', function () {
     it('success', async function () {
@@ -881,7 +881,7 @@ describe('DatabaseSQLite', function () {
       const dbResult1 = {
         changes: 1,
         lastInsertRowid: undefined,
-      }
+      };
       const expected = {
         changes: 1,
         lastInsertRowid: undefined,
@@ -901,7 +901,7 @@ describe('DatabaseSQLite', function () {
       const dbResult1 = {
         changes: 1,
         lastInsertRowid: undefined,
-      }
+      };
       const expected = {
         changes: 1,
         lastInsertRowid: undefined,
@@ -921,7 +921,7 @@ describe('DatabaseSQLite', function () {
       const dbResult1 = {
         changes: 0,
         lastInsertRowid: undefined,
-      }
+      };
       sinon.stub(db.statement.topicAttempts, 'get').returns(dbGet);
       sinon.stub(db.statement.topicAttemptsIncrement, 'run').returns(dbResult0);
       sinon.stub(db.statement.topicContentFetchDone, 'run').returns(dbResult1);
@@ -941,7 +941,7 @@ describe('DatabaseSQLite', function () {
       const dbResult1 = {
         changes: 0,
         lastInsertRowid: undefined,
-      }
+      };
       sinon.stub(db.statement.topicAttempts, 'get').returns(dbGet);
       sinon.stub(db.statement.topicAttemptsIncrement, 'run').returns(dbResult0);
       sinon.stub(db.statement.topicContentFetchDone, 'run').returns(dbResult1);
@@ -1151,7 +1151,22 @@ describe('DatabaseSQLite', function () {
       }
       assert(db.statement.topicDeleteById.run.called);
     });
-  });
+  }); // topicPendingDelete
+
+  describe('topicPublishHistory', function () {
+    beforeEach(function () {
+      sinon.stub(db.statement.topicPublishHistory, 'all');
+    });
+    it('success', function () {
+      db.statement.topicPublishHistory.all.returns([
+        { daysAgo: 1, contentUpdates: 1 },
+        { daysAgo: 3, contentUpdates: 2 },
+      ]);
+      const result = db.topicPublishHistory(dbCtx, topicId, 7);
+      const expected = [0, 1, 0, 2, 0, 0, 0];
+      assert.deepStrictEqual(result, expected);
+    });
+  }); // topicPublishHistory
 
   describe('topicSet', function () {
     let data;
@@ -1519,7 +1534,7 @@ describe('DatabaseSQLite', function () {
       DB._verificationDataToEngine(data);
       assert.strictEqual(data.isPublisherValidated, 0);
     });
-  }) // _verificationDataToEngine
+  }); // _verificationDataToEngine
 
   describe('verificationInsert', function () {
     let verification;
@@ -1610,7 +1625,7 @@ describe('DatabaseSQLite', function () {
       const dbResult = {
         changes: 0,
         lastInsertRowid: undefined,
-      }
+      };
       sinon.stub(db.statement.verificationUpdate, 'run').returns(dbResult);
       try {
         await db.verificationUpdate(dbCtx, verificationId, data);
@@ -1635,7 +1650,7 @@ describe('DatabaseSQLite', function () {
       const dbResult = {
         changes: 1,
         lastInsertRowid: undefined,
-      }
+      };
       sinon.stub(db.statement.verificationValidate, 'run').returns(dbResult);
       await db.verificationValidated(dbCtx, verificationId);
     });
@@ -1643,7 +1658,7 @@ describe('DatabaseSQLite', function () {
       const dbResult = {
         changes: 0,
         lastInsertRowid: undefined,
-      }
+      };
       sinon.stub(db.statement.verificationValidate, 'run').returns(dbResult);
       try {
         await db.verificationValidated(dbCtx, verificationId);