diff options
Diffstat (limited to 'packages/browser/src/methods/startRegistration.test.ts')
-rw-r--r-- | packages/browser/src/methods/startRegistration.test.ts | 33 |
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'); }); }); |