summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/supportsWebauthn.test.ts
blob: 078c27de058e62e88b5f627e8169c644585eed07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import supportsWebauthn from './supportsWebauthn';

beforeEach(() => {
  // @ts-ignore 2741
  window.PublicKeyCredential = jest.fn().mockReturnValue(() => {});
});

test('should return true when browser supports WebAuthn', () => {
  expect(supportsWebauthn()).toBe(true);
});

test('should return false when browser does not support WebAuthn', () => {
  delete window.PublicKeyCredential;
  expect(supportsWebauthn()).toBe(false);
});