Skip to content

Commit 17af0e0

Browse files
committed
update snapshot and fix tests
1 parent 3d2c333 commit 17af0e0

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
@@ -693,8 +693,9 @@ describe("return-dispatch", () => {
693693

694694
assertOnlyCalled(coreInfoLogMock);
695695

696-
expect(coreInfoLogMock).toHaveBeenCalledOnce();
696+
expect(coreInfoLogMock).toHaveBeenCalledTimes(2);
697697
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
698+
expect(coreInfoLogMock.mock.calls[1]?.[0]).toMatchSnapshot();
698699

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

810-
expect(coreInfoLogMock).toHaveBeenCalledOnce();
811+
expect(coreInfoLogMock).toHaveBeenCalledTimes(2);
811812
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
813+
expect(coreInfoLogMock.mock.calls[1]?.[0]).toMatchSnapshot();
812814

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

827-
expect(coreInfoLogMock).toHaveBeenCalledOnce();
829+
expect(coreInfoLogMock).toHaveBeenCalledTimes(2);
828830
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
831+
expect(coreInfoLogMock.mock.calls[1]?.[0]).toMatch(
832+
/Waiting for \d{4,5}ms before the next attempt\.\.\./,
833+
);
829834

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

833838
expect(utilSleepMock).toHaveBeenCalledTimes(3);
834-
expect(utilSleepMock).toHaveBeenCalledWith(retryMs * 3);
839+
expect(utilSleepMock.mock.calls[2]?.[0]).toBeLessThanOrEqual(retryMs * 3);
835840

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

0 commit comments

Comments
 (0)