From 82f7b8ae6d9dd47a93c5fd802fac2a3df526f782 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 17 Aug 2023 10:31:48 -0700 Subject: Update verifyAuthenticationResponse tests --- packages/server/src/helpers/decodeClientDataJSON.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/server/src/helpers/decodeClientDataJSON.ts') diff --git a/packages/server/src/helpers/decodeClientDataJSON.ts b/packages/server/src/helpers/decodeClientDataJSON.ts index bb878dc..fa09181 100644 --- a/packages/server/src/helpers/decodeClientDataJSON.ts +++ b/packages/server/src/helpers/decodeClientDataJSON.ts @@ -7,7 +7,7 @@ export function decodeClientDataJSON(data: string): ClientDataJSON { const toString = isoBase64URL.toString(data); const clientData: ClientDataJSON = JSON.parse(toString); - return clientData; + return _decodeClientDataJSONInternals.stubThis(clientData); } export type ClientDataJSON = { @@ -20,3 +20,8 @@ export type ClientDataJSON = { status: "present" | "supported" | "not-supported"; }; }; + +// Make it possible to stub the return value during testing +export const _decodeClientDataJSONInternals = { + stubThis: (value: ClientDataJSON) => value, +}; -- cgit v1.2.3