diff options
author | Matthew Miller <matthew@millerti.me> | 2023-03-15 21:30:07 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2023-03-15 21:30:07 -0700 |
commit | 766603df24c54f740b6164ce298c31f8dc75715f (patch) | |
tree | 88669cbb8fbeefddea12933742a06c9df8d60943 /packages/browser/src/helpers/webAuthnAbortService.test.ts | |
parent | f3ea79a85070c986eb940491bc453d90ac037ec3 (diff) |
Update WebAuthnAbortService test
Diffstat (limited to 'packages/browser/src/helpers/webAuthnAbortService.test.ts')
-rw-r--r-- | packages/browser/src/helpers/webAuthnAbortService.test.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/browser/src/helpers/webAuthnAbortService.test.ts b/packages/browser/src/helpers/webAuthnAbortService.test.ts index b3ec518..98c1ccd 100644 --- a/packages/browser/src/helpers/webAuthnAbortService.test.ts +++ b/packages/browser/src/helpers/webAuthnAbortService.test.ts @@ -7,7 +7,7 @@ test('should create a new abort signal every time', () => { expect(signal2).not.toBe(signal1); }); -test('should call abort() on existing controller when creating a new signal', () => { +test('should call abort() with AbortError on existing controller when creating a new signal', () => { // Populate `.controller` webauthnAbortService.createNewAbortSignal(); @@ -19,4 +19,9 @@ test('should call abort() on existing controller when creating a new signal', () // Generate a new signal, which should call `abort()` on the existing controller webauthnAbortService.createNewAbortSignal(); expect(abortSpy).toHaveBeenCalledTimes(1); + + // Make sure we raise an AbortError so it can be detected correctly + const abortReason = abortSpy.mock.calls[0][0]; + expect(abortReason).toBeInstanceOf(Error); + expect(abortReason.name).toEqual('AbortError'); }); |