test: dedupe tui command mock reads

This commit is contained in:
Peter Steinberger
2026-05-13 03:04:11 +01:00
parent 784b6cf2da
commit fc09643aa2

View File

@@ -22,7 +22,8 @@ function expectSendChatFields(
sendChat: ReturnType<typeof vi.fn>,
expected: { message: string; sessionId?: string; sessionKey?: string },
) {
const call = sendChat.mock.calls.at(-1);
const calls = sendChat.mock.calls;
const call = calls[calls.length - 1];
if (!call) {
throw new Error("expected gateway sendChat call");
}
@@ -39,7 +40,7 @@ function expectSendChatFields(
type MockWithCalls = { mock: { calls: unknown[][] } };
function firstMockArg(mock: MockWithCalls, label: string) {
const call = mock.mock.calls.at(0);
const call = mock.mock.calls[0];
if (!call) {
throw new Error(`expected ${label} call`);
}