update dependencies and devDependencies, fix lint issues
[squeep-indie-auther] / test / src / service.js
index ab6646f19ae9ecccb817388cb8bbb71a18396e82..55cfec2111621915d5eb5ce01422bc21ea8b6850 100644 (file)
@@ -1,10 +1,7 @@
-/* eslint-env mocha */
-/* eslint-disable capitalized-comments */
-
 'use strict';
 
 const assert = require('assert');
-const sinon = require('sinon'); // eslint-disable-line node/no-unpublished-require
+const sinon = require('sinon');
 const { AsyncLocalStorage } = require('node:async_hooks');
 
 const StubDb = require('../stub-db');
@@ -106,6 +103,32 @@ describe('Service', function () {
     });
   }); // handlerGetAdminLogout
 
+  describe('handlerGetAdminSettings', function () {
+    it('covers authenticated', async function () {
+      service.authenticator.sessionRequiredLocal.resolves(true);
+      await service.handlerGetAdminSettings(req, res, ctx);
+      assert(service.sessionManager.getAdminSettings.called);
+    });
+    it('covers unauthenticated', async function () {
+      service.authenticator.sessionRequiredLocal.resolves(false);
+      await service.handlerGetAdminSettings(req, res, ctx);
+      assert(service.sessionManager.getAdminSettings.notCalled);
+    });
+  }); // handlerGetAdminSettings
+
+  describe('handlerPostAdminSettings', function () {
+    it('covers authenticated', async function () {
+      service.authenticator.sessionRequiredLocal.resolves(true);
+      await service.handlerPostAdminSettings(req, res, ctx);
+      assert(service.sessionManager.postAdminSettings.called);
+    });
+    it('covers unauthenticated', async function () {
+      service.authenticator.sessionRequiredLocal.resolves(false);
+      await service.handlerPostAdminSettings(req, res, ctx);
+      assert(service.sessionManager.postAdminSettings.notCalled);
+    });
+  }); // handlerPostAdminSettings
+
   describe('handlerGetAdmin', function () {
     it('covers authenticated', async function () {
       service.authenticator.sessionRequiredLocal.resolves(true);
@@ -297,4 +320,4 @@ describe('Service', function () {
     });
   }); // handlerWhaGwan
 
-});
\ No newline at end of file
+});