Skip to content

Commit 5d9a90d

Browse files
Merge branch 'webauthn-autocomplete-extra-fixes' of github.com:thomas-schofield-fr/forgerock-javascript-sdk into webauthn-autocomplete-extra-fixes
2 parents 050059e + 7a74994 commit 5d9a90d

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

packages/javascript-sdk/src/fr-webauthn/fr-webauthn.mock.data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ export const webAuthnAuthConditionalMetaCallback = {
505505
_allowCredentials: [],
506506
timeout: 60000,
507507
userVerification: 'preferred',
508-
conditionalWebAuthn: true,
508+
mediation: 'conditional',
509509
relyingPartyId: '',
510510
_relyingPartyId: 'example.com',
511511
extensions: {},

packages/javascript-sdk/src/fr-webauthn/fr-webauthn.test.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe('Test FRWebAuthn class with Conditional UI', () => {
149149
_allowCredentials: [],
150150
timeout: 60000,
151151
userVerification: 'preferred',
152-
conditionalWebAuthn: true,
152+
mediation: 'conditional',
153153
relyingPartyId: '',
154154
_relyingPartyId: 'example.com',
155155
extensions: {},
@@ -180,19 +180,10 @@ describe('Test FRWebAuthn class with Conditional UI', () => {
180180
vi.spyOn(window.PublicKeyCredential, 'isConditionalMediationAvailable').mockResolvedValue(
181181
false,
182182
);
183-
// FIX APPLIED HERE: Added block comment to empty function
184-
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {
185-
/* empty */
186-
});
187183
const getSpy = vi.spyOn(navigator.credentials, 'get');
188184

189185
// Attempt to authenticate with conditional UI requested
190-
await FRWebAuthn.getAuthenticationCredential({}, true);
191-
192-
// Expect a warning to be logged
193-
expect(consoleSpy).toHaveBeenCalledWith(
194-
'Conditional UI was requested, but is not supported by this browser.',
195-
);
186+
await FRWebAuthn.getAuthenticationCredential({});
196187

197188
// Expect the call to navigator.credentials.get to NOT have the mediation property
198189
expect(getSpy).toHaveBeenCalledWith(
@@ -208,7 +199,9 @@ describe('Test FRWebAuthn class with Conditional UI', () => {
208199
const getSpy = vi.spyOn(navigator.credentials, 'get');
209200

210201
// Attempt to authenticate with conditional UI requested
211-
await FRWebAuthn.getAuthenticationCredential({}, true);
202+
await FRWebAuthn.getAuthenticationCredential({
203+
mediation: 'conditional',
204+
});
212205

213206
// Expect the call to navigator.credentials.get to have the mediation property
214207
expect(getSpy).toHaveBeenCalledWith(

0 commit comments

Comments
 (0)