1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-03 17:13:14 +00:00

Add test for setCryptoKeys parameter

This commit is contained in:
Thomas Rittson
2021-12-15 11:16:03 +10:00
parent 6e34585dfd
commit 75db9be248

View File

@@ -204,4 +204,29 @@ describe('Cipher Service', () => {
messagingService.didNotReceive().send(Arg.any());
expect(result).toEqual(expected);
});
it('logIn: does not set crypto keys if setCryptoKeys is false', async () => {
logInSetup();
commonSetup();
const tokenResponse = newTokenResponse();
tokenService.getTwoFactorToken(email).resolves(null);
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
// Re-init authService with setCryptoKeys = false
authService = new AuthService(cryptoService, apiService, tokenService, appIdService, i18nService,
platformUtilsService, messagingService, vaultTimeoutService, logService, cryptoFunctionService,
keyConnectorService, environmentService, stateService, false);
authService.init();
// Act
const result = await authService.logIn(email, masterPassword);
// Assertions
commonSuccessAssertions();
cryptoService.didNotReceive().setKey(Arg.any());
cryptoService.didNotReceive().setKeyHash(Arg.any());
cryptoService.didNotReceive().setEncKey(Arg.any());
cryptoService.didNotReceive().setEncPrivateKey(Arg.any());
});
});