diff options
Diffstat (limited to 'packages/browser/src/helpers')
-rw-r--r-- | packages/browser/src/helpers/webAuthnAbortService.test.ts | 12 | ||||
-rw-r--r-- | packages/browser/src/helpers/webAuthnAbortService.ts | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/packages/browser/src/helpers/webAuthnAbortService.test.ts b/packages/browser/src/helpers/webAuthnAbortService.test.ts index 506bb2a..a538dff 100644 --- a/packages/browser/src/helpers/webAuthnAbortService.test.ts +++ b/packages/browser/src/helpers/webAuthnAbortService.test.ts @@ -1,23 +1,23 @@ -import { webauthnAbortService } from './webAuthnAbortService'; +import { WebauthnAbortService } from './webAuthnAbortService'; test('should create a new abort signal every time', () => { - const signal1 = webauthnAbortService.createNewAbortSignal(); - const signal2 = webauthnAbortService.createNewAbortSignal(); + const signal1 = WebauthnAbortService.createNewAbortSignal(); + const signal2 = WebauthnAbortService.createNewAbortSignal(); expect(signal2).not.toBe(signal1); }); test('should call abort() with AbortError on existing controller when creating a new signal', () => { // Populate `.controller` - webauthnAbortService.createNewAbortSignal(); + WebauthnAbortService.createNewAbortSignal(); // Spy on the existing instance of AbortController const abortSpy = jest.fn(); // @ts-ignore: Ignore the fact that `controller` is private - webauthnAbortService.controller.abort = abortSpy; + WebauthnAbortService.controller.abort = abortSpy; // Generate a new signal, which should call `abort()` on the existing controller - webauthnAbortService.createNewAbortSignal(); + WebauthnAbortService.createNewAbortSignal(); expect(abortSpy).toHaveBeenCalledTimes(1); // Make sure we raise an AbortError so it can be detected correctly diff --git a/packages/browser/src/helpers/webAuthnAbortService.ts b/packages/browser/src/helpers/webAuthnAbortService.ts index 50e00ba..ed007e2 100644 --- a/packages/browser/src/helpers/webAuthnAbortService.ts +++ b/packages/browser/src/helpers/webAuthnAbortService.ts @@ -2,7 +2,7 @@ * A way to cancel an existing WebAuthn request, for example to cancel a * WebAuthn autofill authentication request for a manual authentication attempt. */ -class WebAuthnAbortService { +class BaseWebAuthnAbortService { private controller: AbortController | undefined; /** @@ -26,4 +26,4 @@ class WebAuthnAbortService { } } -export const webauthnAbortService = new WebAuthnAbortService(); +export const WebauthnAbortService = new BaseWebAuthnAbortService(); |