1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-24 04:04:38 +00:00

Add test: do not set keys in new SSO user flow

This commit is contained in:
Thomas Rittson
2021-12-16 09:21:10 +10:00
parent f0bfc7c68d
commit 1ec50eb1e8

View File

@@ -333,7 +333,6 @@ describe('Cipher Service', () => {
actual.captchaResponse == null));
// Sets local environment:
// TODO: analyse actual behaviour and update
commonSuccessAssertions();
cryptoService.received(1).setEncPrivateKey(privateKey);
cryptoService.received(1).setEncKey(encKey);
@@ -352,6 +351,22 @@ describe('Cipher Service', () => {
expect(result).toEqual(expected);
});
it('logInSso: do not set keys for new SSO user flow', async () => {
commonSetup();
const tokenResponse = newTokenResponse();
tokenResponse.key = null;
tokenService.getTwoFactorToken(null).resolves(null);
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
const result = await authService.logInSso(ssoCode, ssoCodeVerifier, ssoRedirectUrl, ssoOrgId);
// Assert
cryptoService.didNotReceive().setEncPrivateKey(privateKey);
cryptoService.didNotReceive().setEncKey(encKey);
});
it('logInSso: gets and sets KeyConnector key for enrolled user', async () => {
commonSetup();
const tokenResponse = newTokenResponse();