Skip to content

Commit 129f1bc

Browse files
authored
test: fix stale core test type failures (#98551)
1 parent aa91c9d commit 129f1bc

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/gateway/server-cron-notifications.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ function requireRecord(value: unknown, label: string): Record<string, unknown> {
3131
}
3232

3333
function webhookRequestBody() {
34-
const request = requireRecord(mocks.fetchWithSsrFGuard.mock.calls[0]?.[0], "webhook request");
34+
const call = (mocks.fetchWithSsrFGuard.mock.calls as unknown[][])[0];
35+
if (!call) {
36+
throw new Error("expected webhook request call");
37+
}
38+
const request = requireRecord(call[0], "webhook request");
3539
const init = requireRecord(request.init, "webhook request init");
3640
if (typeof init.body !== "string") {
3741
throw new Error("expected webhook request body");

src/gateway/server-cron.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,12 @@ describe("buildGatewayCronService", () => {
621621
await state.cron.run(job.id, "force");
622622

623623
const event = runCronChangedMock.mock.calls
624-
.map((call) => requireRecord(call[0], "cron_changed event"))
624+
.map((_, index) =>
625+
requireRecord(
626+
callArg(runCronChangedMock, index, 0, "cron_changed event"),
627+
"cron_changed event",
628+
),
629+
)
625630
.find((hookEvent) => hookEvent.action === "finished");
626631
const summary = typeof event?.summary === "string" ? event.summary : "";
627632
expect(summary).toContain("[redacted-url]");
@@ -714,7 +719,12 @@ describe("buildGatewayCronService", () => {
714719
expect(sendCronAnnouncePayloadStrictMock).not.toHaveBeenCalled();
715720

716721
const event = runCronChangedMock.mock.calls
717-
.map((call) => requireRecord(call[0], "cron_changed event"))
722+
.map((_, index) =>
723+
requireRecord(
724+
callArg(runCronChangedMock, index, 0, "cron_changed event"),
725+
"cron_changed event",
726+
),
727+
)
718728
.find((hookEvent) => hookEvent.action === "finished");
719729
expect(event?.summary).toBe(summary);
720730
} finally {

0 commit comments

Comments
 (0)