Skip to content

Commit 1674d6a

Browse files
YermanacoCodex-
authored andcommitted
update snapshot and fix tests
1 parent 87b877d commit 1674d6a

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/__snapshots__/return-dispatch.spec.ts.snap

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,30 @@ exports[`return-dispatch > getRunIdAndUrl > should call retryOrTimeout with the
66

77
exports[`return-dispatch > getRunIdAndUrl > should retry until an ID is found 1`] = `"No Run IDs found for workflow, attempt 1..."`;
88

9-
exports[`return-dispatch > getRunIdAndUrl > should retry until an ID is found 2`] = `"No Run IDs found for workflow, attempt 2..."`;
9+
exports[`return-dispatch > getRunIdAndUrl > should retry until an ID is found 2`] = `"Waiting for 5000ms before the next attempt..."`;
1010

11-
exports[`return-dispatch > getRunIdAndUrl > should retry until an ID is found 3`] = `"Attempting to get step names for Run IDs: [0]"`;
11+
exports[`return-dispatch > getRunIdAndUrl > should retry until an ID is found 3`] = `"No Run IDs found for workflow, attempt 2..."`;
12+
13+
exports[`return-dispatch > getRunIdAndUrl > should retry until an ID is found 4`] = `"Waiting for 10000ms before the next attempt..."`;
14+
15+
exports[`return-dispatch > getRunIdAndUrl > should retry until an ID is found 5`] = `"Attempting to get step names for Run IDs: [0]"`;
1216

1317
exports[`return-dispatch > getRunIdAndUrl > should return the ID when found 1`] = `"Attempting to get step names for Run IDs: [0]"`;
1418

1519
exports[`return-dispatch > getRunIdAndUrl > should return the ID when found 2`] = `undefined`;
1620

1721
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 1`] = `"Exhausted searching IDs in known runs, attempt 1..."`;
1822

19-
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 2`] = `"Attempting to get step names for Run IDs: [0]"`;
23+
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 2`] = `"Waiting for 3000ms before the next attempt..."`;
2024

21-
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 3`] = `"Exhausted searching IDs in known runs, attempt 2..."`;
25+
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 3`] = `"Attempting to get step names for Run IDs: [0]"`;
2226

23-
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 4`] = `"Attempting to get step names for Run IDs: [0]"`;
27+
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 4`] = `"Exhausted searching IDs in known runs, attempt 2..."`;
2428

25-
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 5`] = `"Exhausted searching IDs in known runs, attempt 3..."`;
29+
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 5`] = `"Waiting for 6000ms before the next attempt..."`;
2630

2731
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 6`] = `"Attempting to get step names for Run IDs: [0]"`;
32+
33+
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 7`] = `"Exhausted searching IDs in known runs, attempt 3..."`;
34+
35+
exports[`return-dispatch > getRunIdAndUrl > should timeout when unable to find over time 8`] = `"Attempting to get step names for Run IDs: [0]"`;

src/return-dispatch.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,9 @@ describe("return-dispatch", () => {
694694

695695
assertOnlyCalled(coreInfoLogMock);
696696

697-
expect(coreInfoLogMock).toHaveBeenCalledOnce();
697+
expect(coreInfoLogMock).toHaveBeenCalledTimes(2);
698698
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
699+
expect(coreInfoLogMock.mock.calls[1]?.[0]).toMatchSnapshot();
699700

700701
expect(utilSleepMock).toHaveBeenCalledTimes(2);
701702
expect(utilSleepMock).toHaveBeenCalledWith(retryMs * 2);
@@ -808,8 +809,9 @@ describe("return-dispatch", () => {
808809
expect(apiFetchWorkflowRunJobStepsMock).toHaveBeenCalledTimes(2);
809810
assertOnlyCalled(coreDebugLogMock, coreInfoLogMock);
810811

811-
expect(coreInfoLogMock).toHaveBeenCalledOnce();
812+
expect(coreInfoLogMock).toHaveBeenCalledTimes(2);
812813
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
814+
expect(coreInfoLogMock.mock.calls[1]?.[0]).toMatchSnapshot();
813815

814816
expect(coreDebugLogMock).toHaveBeenCalledOnce();
815817
expect(coreDebugLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
@@ -825,14 +827,17 @@ describe("return-dispatch", () => {
825827
expect(apiFetchWorkflowRunJobStepsMock).toHaveBeenCalledTimes(3);
826828
assertOnlyCalled(coreDebugLogMock, coreInfoLogMock);
827829

828-
expect(coreInfoLogMock).toHaveBeenCalledOnce();
830+
expect(coreInfoLogMock).toHaveBeenCalledTimes(2);
829831
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
832+
expect(coreInfoLogMock.mock.calls[1]?.[0]).toMatch(
833+
/Waiting for \d{4,5}ms before the next attempt\.\.\./,
834+
);
830835

831836
expect(coreDebugLogMock).toHaveBeenCalledOnce();
832837
expect(coreDebugLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
833838

834839
expect(utilSleepMock).toHaveBeenCalledTimes(3);
835-
expect(utilSleepMock).toHaveBeenCalledWith(retryMs * 3);
840+
expect(utilSleepMock.mock.calls[2]?.[0]).toBeLessThanOrEqual(retryMs * 3);
836841

837842
resetLogMocks();
838843
await vi.advanceTimersByTimeAsync(retryMs * 3);

0 commit comments

Comments
 (0)