summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/supportsWebauthn.test.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-05-21 11:55:06 -0700
committerMatthew Miller <matthew@millerti.me>2020-05-21 11:55:06 -0700
commit019190e91cff53d78f48c6c70e2ea8da23846a94 (patch)
tree47705ee3c442b2d351a955b39e38a7881c5b78a1 /packages/browser/src/helpers/supportsWebauthn.test.ts
parent0ef186ddb89a4c03a95db864260f51c5ccfadb39 (diff)
Add remaining unit tests for browser
Diffstat (limited to 'packages/browser/src/helpers/supportsWebauthn.test.ts')
-rw-r--r--packages/browser/src/helpers/supportsWebauthn.test.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/browser/src/helpers/supportsWebauthn.test.ts b/packages/browser/src/helpers/supportsWebauthn.test.ts
new file mode 100644
index 0000000..078c27d
--- /dev/null
+++ b/packages/browser/src/helpers/supportsWebauthn.test.ts
@@ -0,0 +1,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);
+});