Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gaokevin1 committed Dec 18, 2024
1 parent f002ee1 commit a9bbf39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 0 additions & 3 deletions packages/sdks/web-js-sdk/src/sdk/fedcm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ const createFedCM = (sdk: CoreSdk, projectId: string) => ({
async isLoggedIn(
context?: IdentityCredentialRequestOptionsContext,
): Promise<boolean> {
if (!this.isSupported()) {
return false;
}
const configURL = sdk.httpClient.buildUrl(
projectId + apiPaths.fedcm.config,
);
Expand Down
4 changes: 4 additions & 0 deletions packages/sdks/web-js-sdk/test/fedcm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ describe('fedcm', () => {

it('should return false if navigator.credentials.get returns null', async () => {
const mockGet = jest.fn();
// @ts-ignore
global.navigator.credentials = { get: mockGet };
mockGet.mockResolvedValue(null);

const result = await sdk.fedcm.isLoggedIn();
Expand All @@ -252,6 +254,8 @@ describe('fedcm', () => {

it('should return false if navigator.credentials.get throws an error', async () => {
const mockGet = jest.fn();
// @ts-ignore
global.navigator.credentials = { get: mockGet };
mockGet.mockRejectedValue(new Error('Test Error'));

const result = await sdk.fedcm.isLoggedIn();
Expand Down

0 comments on commit a9bbf39

Please sign in to comment.