summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods/startRegistration.test.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-02-08 17:56:26 -0800
committerMatthew Miller <matthew@millerti.me>2023-02-08 17:56:26 -0800
commitdc40f408e45fd6c8c053cc4c63e99ad96a739d39 (patch)
tree2cc5ecfa7ede5cbb11bcf9babbf512ac23ef5a94 /packages/browser/src/methods/startRegistration.test.ts
parentc60637b719dc12875dc8fde586f972021f4930a1 (diff)
Update tests
Diffstat (limited to 'packages/browser/src/methods/startRegistration.test.ts')
-rw-r--r--packages/browser/src/methods/startRegistration.test.ts33
1 files changed, 28 insertions, 5 deletions
diff --git a/packages/browser/src/methods/startRegistration.test.ts b/packages/browser/src/methods/startRegistration.test.ts
index 8ba6f5a..2c2d2de 100644
--- a/packages/browser/src/methods/startRegistration.test.ts
+++ b/packages/browser/src/methods/startRegistration.test.ts
@@ -324,15 +324,38 @@ describe('WebAuthnError', () => {
});
describe('NotAllowedError', () => {
- const NotAllowedError = generateCustomError('NotAllowedError');
+ test('should pass through error message (iOS Safari - Operation failed)', async () => {
+ /**
+ * Thrown when biometric is not enrolled, or a Safari bug prevents conditional UI from being
+ * aborted properly between page reloads.
+ *
+ * See https://github.com/MasterKale/SimpleWebAuthn/discussions/350#discussioncomment-4896572
+ */
+ const NotAllowedError = generateCustomError('NotAllowedError', 'Operation failed.');
+ mockNavigatorCreate.mockRejectedValueOnce(NotAllowedError);
+
+ const rejected = await expect(startRegistration(goodOpts1)).rejects;
+ rejected.toThrow(Error);
+ rejected.toThrow(/operation failed/i);
+ rejected.toHaveProperty('name', 'NotAllowedError');
+ });
- test('should identify cancellation or timeout', async () => {
+ test('should pass through error message (Chrome M110 - Bad TLS Cert)', async () => {
+ /**
+ * Starting from Chrome M110, WebAuthn is blocked if the site is being displayed on a URL with
+ * TLS certificate issues. This includes during development.
+ *
+ * See https://github.com/MasterKale/SimpleWebAuthn/discussions/351#discussioncomment-4910458
+ */
+ const NotAllowedError = generateCustomError(
+ 'NotAllowedError',
+ 'WebAuthn is not supported on sites with TLS certificate errors.'
+ );
mockNavigatorCreate.mockRejectedValueOnce(NotAllowedError);
const rejected = await expect(startRegistration(goodOpts1)).rejects;
- rejected.toThrow(WebAuthnError);
- rejected.toThrow(/cancel/i);
- rejected.toThrow(/timed out/i);
+ rejected.toThrow(Error);
+ rejected.toThrow(/sites with TLS certificate errors/i);
rejected.toHaveProperty('name', 'NotAllowedError');
});
});