update dependencies and devDependencies, address lint issues
[squeep-indie-auther] / test / src / service.js
index 31365794992b578cbb33b687ac9848d831fd1d6a..d91112548a75c6617e6b2f92987d43b74dfc1ede 100644 (file)
@@ -1,10 +1,8 @@
-/* eslint-env mocha */
-/* eslint-disable capitalized-comments */
-
+/* eslint-disable sonarjs/no-duplicate-string */
 '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 +104,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);
@@ -291,4 +315,10 @@ describe('Service', function () {
     });
   }); // handlerGetAdminMaintenance
 
-});
\ No newline at end of file
+  describe('handlerWhaGwan', function () {
+    it('covers', async function () {
+      await assert.rejects(() => service.handlerWhaGwan(req. res, ctx));
+    });
+  }); // handlerWhaGwan
+
+});