




















@@ -110,7 +110,11 @@ function objectArgAt(
110110}
111111112112function argAt(mock: MockWithCalls, callIndex: number, argIndex: number): unknown {
113-return mock.mock.calls[callIndex]?.[argIndex];
113+const call = mock.mock.calls[callIndex];
114+if (!call || !(argIndex in call)) {
115+throw new Error(`expected call ${callIndex} argument ${argIndex}`);
116+}
117+return call[argIndex];
114118}
115119116120function recordField(value: unknown, field: string): Record<string, unknown> {
@@ -444,7 +448,7 @@ describe("discordPlugin outbound", () => {
444448target: "channel:222",
445449});
446450447-expect(fetchPermissionsSpy.mock.calls[0]?.[0]).toBe("222");
451+expect(argAt(fetchPermissionsSpy, 0, 0)).toBe("222");
448452expect(objectArgAt(fetchPermissionsSpy, 0, 1).token).toBe("discord-token");
449453const permissions = recordField(diagnostics?.details?.permissions, "permissions");
450454expect(permissions.channelId).toBe("222");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。