PM-7392 - TokenSvc - getRefreshToken should return null or a value - not undefined.

This commit is contained in:
Jared Snider 2024-05-02 18:26:24 -04:00
parent cd7680329d
commit 3e9f904e84
No known key found for this signature in database
GPG Key ID: A149DDD612516286
2 changed files with 3 additions and 3 deletions

View File

@ -1214,7 +1214,7 @@ describe("TokenService", () => {
// Act // Act
const result = await (tokenService as any).getRefreshToken(); const result = await (tokenService as any).getRefreshToken();
// Assert // Assert
expect(result).toBeUndefined(); expect(result).toBeNull();
}); });
it("should return null if no refresh token is found in memory, disk, or secure storage", async () => { it("should return null if no refresh token is found in memory, disk, or secure storage", async () => {

View File

@ -550,11 +550,11 @@ export class TokenService implements TokenServiceAbstraction {
} }
} }
async getRefreshToken(userId?: UserId): Promise<string | undefined> { async getRefreshToken(userId?: UserId): Promise<string | null> {
userId ??= await firstValueFrom(this.activeUserIdGlobalState.state$); userId ??= await firstValueFrom(this.activeUserIdGlobalState.state$);
if (!userId) { if (!userId) {
return undefined; return null;
} }
// pre-secure storage migration: // pre-secure storage migration: