From 4f621377da1c824a513c82900097168e9b8d4822 Mon Sep 17 00:00:00 2001 From: Ned Wolpert Date: Sat, 20 Jun 2026 11:31:09 -0700 Subject: [PATCH] test(browser): fix TS6 typecheck errors in ceremonies mediation test The "requests conditional mediation only when conditional=true" test declared its CredentialsContainer.get mocks with zero parameters (vi.fn(async () => ...)). Under TypeScript 6, mock.calls[0] is then typed as an empty tuple [], so indexing [0] failed (TS2493) and casting the resulting undefined element to CredentialRequestOptions failed (TS2352). Give both mocks the real get signature (_options?: CredentialRequestOptions) so the recorded call args are typed correctly. Test-only change; no production source touched. typecheck is now clean and all 101 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) --- clients/passkeys-browser/test/ceremonies.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/passkeys-browser/test/ceremonies.test.ts b/clients/passkeys-browser/test/ceremonies.test.ts index 81420cd..4ba1767 100644 --- a/clients/passkeys-browser/test/ceremonies.test.ts +++ b/clients/passkeys-browser/test/ceremonies.test.ts @@ -435,7 +435,7 @@ describe("PkAuthCeremonyClient.authenticate (end-to-end with stubbed credentials "/authentication/finish": { token: "t" }, }; // conditional = true -> mediation set - const getCond = vi.fn(async () => fakeAssertion(new Uint8Array([1]))); + const getCond = vi.fn(async (_options?: CredentialRequestOptions) => fakeAssertion(new Uint8Array([1]))); const a = ceremonyFetch(responses); await new PkAuthCeremonyClient( { apiBase: "https://x", fetch: a.fetchImpl as unknown as typeof fetch }, @@ -446,7 +446,7 @@ describe("PkAuthCeremonyClient.authenticate (end-to-end with stubbed credentials ).toBe("conditional"); // conditional defaults to false -> no mediation - const getPlain = vi.fn(async () => fakeAssertion(new Uint8Array([1]))); + const getPlain = vi.fn(async (_options?: CredentialRequestOptions) => fakeAssertion(new Uint8Array([1]))); const b = ceremonyFetch(responses); await new PkAuthCeremonyClient( { apiBase: "https://x", fetch: b.fetchImpl as unknown as typeof fetch },