test: dedupe tools catalog mock reads

This commit is contained in:
Peter Steinberger
2026-05-12 23:13:32 +01:00
parent 5ab28bf164
commit ed3df9cbb8

View File

@@ -54,7 +54,7 @@ function createInvokeParams(params: Record<string, unknown>) {
}
function firstMockArg(mock: { mock: { calls: unknown[][] } }, label: string): unknown {
const arg = mock.mock.calls.at(0)?.at(0);
const arg = mock.mock.calls[0]?.[0];
if (arg === undefined) {
throw new Error(`Expected ${label}`);
}
@@ -62,7 +62,7 @@ function firstMockArg(mock: { mock: { calls: unknown[][] } }, label: string): un
}
function respondCall(respond: ReturnType<typeof vi.fn>): RespondCall {
const call = respond.mock.calls.at(0) as RespondCall | undefined;
const call = respond.mock.calls[0] as RespondCall | undefined;
if (!call) {
throw new Error("expected respond call");
}