add updateOTPKey wrapper to authenticator
[squeep-authentication-module] / test / lib / authenticator.js
index 534fd02df14165d8029582ab6c3a816b24fbfe9a..341bc9bfb52d8bc16df7e3d7bab5ab9937a9b4ce 100644 (file)
@@ -383,6 +383,22 @@ describe('Authenticator', function () {
     });
   }); // checkOTP
 
+  describe('updateOTPKey', function () {
+    let dbCtx, otpKey;
+    beforeEach(function () {
+      dbCtx = {};
+      otpKey = 'CDBGB3U3B2ILECQORMINGGSZN7LXY565';
+    });
+    it('covers success', async function () {
+      await authenticator.updateOTPKey(dbCtx, identifier, otpKey);
+      assert(authenticator.db.authenticationUpdateOTPKey.called);
+    });
+    it('covers failure', async function () {
+      authenticator.db.authenticationUpdateOTPKey.rejects();
+      assert.rejects(authenticator.updateOTPKey(dbCtx, identifier, otpKey));
+    });
+  }); // updateOTPKey
+
   describe('sessionCheck', function () {
     let req, res, loginPath, required, profilesAllowed;
     beforeEach(function () {