Skip to content

Commit fc22fa2

Browse files
committed
test(console): the display-locale harness answers the audit ledger through its authenticated fetch mock
The audit log's ledger read now goes through createAuthenticatedFetch, which this harness mocks with a fixed empty answer; a case that stubs the wire is now answered by its stub. Claude-Session: https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB Co-authored-by: Claude <noreply@anthropic.com>
1 parent f8533fa commit fc22fa2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎ui/apps/console/src/pages/consoleFaces.displayLocale-9909.test.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ vi.mock('@object-ui/i18n', async (importOriginal) => ({
101101
}));
102102

103103
vi.mock('@object-ui/auth', async (importOriginal) => {
104-
const authFetch = async () => new Response('{}', { status: 200 });
104+
// A case that stubs the wire (the audit log's ledger read, which goes through
105+
// the authenticated fetch) is answered by its stub; every other read gets `{}`.
106+
const authFetch = async (input: RequestInfo | URL, init?: RequestInit) =>
107+
vi.isMockFunction(globalThis.fetch) ? globalThis.fetch(input, init) : new Response('{}', { status: 200 });
105108
return {
106109
...(await importOriginal<Record<string, unknown>>()),
107110
useAuth: () => AUTH,

0 commit comments

Comments
 (0)