update html template dependency and templates
[websub-hub] / test / src / service.js
index bb93d2e7cc463efcc7b9193ba14306e9ba2ddd99..cafe1d16922ff9e4e0f48b19921a572e39d7ea2f 100644 (file)
@@ -61,6 +61,20 @@ describe('Service', function () {
     });
   }); // maybeIngestBody
 
+  describe('setHeadHandler', function () {
+    it('covers', function () {
+      const origEnd = res.end;
+      sinon.stub(Service.__proto__, 'setHeadHandler');
+      ctx.responseBody = 'data';
+      req.method = 'HEAD';
+      Service.setHeadHandler(req, res, ctx);
+      res.end('foop');
+      assert(Service.__proto__.setHeadHandler.called);
+      assert(origEnd.called);
+      assert(!('responseBody' in ctx));
+    });
+  }); // setHeadHandler
+
   describe('handlerPostRoot', function () {
     it('covers public mode', async function () {
       await service.handlerPostRoot(req, res, ctx);
@@ -103,7 +117,7 @@ describe('Service', function () {
   describe('handlerGetAdminOverview', function () {
     it('covers', async function () {
       await service.handlerGetAdminOverview(req, res, ctx);
-      assert(service.authenticator.required.called);
+      assert(service.authenticator.sessionRequired.called);
       assert(service.manager.getAdminOverview.called);
     })
   }); // handlerGetAdminOverview
@@ -111,7 +125,7 @@ describe('Service', function () {
   describe('handlerGetAdminTopicDetails', function () {
     it('covers', async function () {
       await service.handlerGetAdminTopicDetails(req, res, ctx);
-      assert(service.authenticator.required.called);
+      assert(service.authenticator.sessionRequired.called);
       assert(service.manager.getTopicDetails.called);
     })
   }); // handlerGetAdminTopicDetails
@@ -120,7 +134,7 @@ describe('Service', function () {
     it('covers', async function () {
       service.serveFile.resolves();
       await service.handlerPostAdminProcess(req, res, ctx);
-      assert(service.authenticator.requiredLocal.called);
+      assert(service.authenticator.apiRequiredLocal.called);
       assert(service.manager.processTasks.called);
     });
   }); // handlerPostAdminProcess
@@ -129,7 +143,7 @@ describe('Service', function () {
     it('covers', async function () {
       sinon.stub(service, 'bodyData').resolves();
       await service.handlerUpdateTopic(req, res, ctx);
-      assert(service.authenticator.requiredLocal.called);
+      assert(service.authenticator.apiRequiredLocal.called);
       assert(service.manager.updateTopic.called);
     });
   }); // handlerUpdateTopic
@@ -138,7 +152,7 @@ describe('Service', function () {
     it('covers', async function () {
       sinon.stub(service, 'bodyData').resolves();
       await service.handlerUpdateSubscription(req, res, ctx);
-      assert(service.authenticator.requiredLocal.called);
+      assert(service.authenticator.apiRequiredLocal.called);
       assert(service.manager.updateSubscription.called);
     });
   }); // handlerUpdateSubscription