PM-7392 - Fix token service tests in prep for adding tests for new scenarios.

This commit is contained in:
Jared Snider 2024-05-02 18:11:37 -04:00
parent 180e658ea3
commit 7ac1c194ad
No known key found for this signature in database
GPG Key ID: A149DDD612516286
1 changed files with 5 additions and 4 deletions

View File

@ -29,8 +29,6 @@ import {
SECURITY_STAMP_MEMORY,
} from "./token.state";
// TODO: add specific tests for new secure storage scenarios.
describe("TokenService", () => {
let tokenService: TokenService;
let singleUserStateProvider: FakeSingleUserStateProvider;
@ -283,11 +281,11 @@ describe("TokenService", () => {
});
describe("getAccessToken", () => {
it("should return undefined if no user id is provided and there is no active user in global state", async () => {
it("should return null if no user id is provided and there is no active user in global state", async () => {
// Act
const result = await tokenService.getAccessToken();
// Assert
expect(result).toBeUndefined();
expect(result).toBeNull();
});
it("should return null if no access token is found in memory, disk, or secure storage", async () => {
@ -1124,6 +1122,9 @@ describe("TokenService", () => {
.getFake(userIdFromAccessToken, REFRESH_TOKEN_MEMORY)
.stateSubject.next([userIdFromAccessToken, refreshToken]);
// We immediately call to get the refresh token from secure storage after setting it to ensure it was set.
secureStorageService.get.mockResolvedValue(refreshToken);
// Act
await (tokenService as any).setRefreshToken(
refreshToken,