blob: ba9f233f737f4cd760e5f6b8c97031b2d55df344 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import { platformAuthenticatorIsAvailable } from './platformAuthenticatorIsAvailable';
const mockIsUVPAA = jest.fn();
beforeEach(() => {
mockIsUVPAA.mockReset();
// @ts-ignore 2741
window.PublicKeyCredential = {
isUserVerifyingPlatformAuthenticatorAvailable: mockIsUVPAA.mockResolvedValue(true),
};
});
test('should return true when platform authenticator is available', async () => {
const isAvailable = await platformAuthenticatorIsAvailable();
expect(isAvailable).toEqual(true);
});
test('should return false when platform authenticator is unavailable', async () => {
mockIsUVPAA.mockResolvedValue(false);
const isAvailable = await platformAuthenticatorIsAvailable();
expect(isAvailable).toEqual(false);
});
|