Skip to content

Commit df062da

Browse files
committed
test: tidy up some snapshots
1 parent 97a8019 commit df062da

File tree

3 files changed

+32
-76
lines changed

3 files changed

+32
-76
lines changed

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

+20-64
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,16 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`return-dispatch > handleAction > getRunIdAndUrl > called fetchWorkflowRunIds with the provided workflowId and branch 1`] = `
4-
[
5-
"Attempting to identify run ID for workflow.yml (123)",
6-
]
7-
`;
8-
9-
exports[`return-dispatch > handleAction > getRunIdAndUrl > called fetchWorkflowRunIds with the provided workflowId and branch 2`] = `
10-
[
11-
"Attempting to get step names for Run IDs: [0]",
12-
]
13-
`;
14-
15-
exports[`return-dispatch > handleAction > getRunIdAndUrl > called fetchWorkflowRunIds with the provided workflowId and branch 3`] = `
16-
[
17-
"Attempting to identify run ID from steps...",
18-
]
19-
`;
20-
21-
exports[`return-dispatch > handleAction > getRunIdAndUrl > should call retryOrTimeout with the larger workflowTimeoutMs timeout value 1`] = `
22-
[
23-
"Attempting to identify run ID for workflow.yml (123)",
24-
]
25-
`;
26-
27-
exports[`return-dispatch > handleAction > getRunIdAndUrl > should call retryOrTimeout with the larger workflowTimeoutMs timeout value 2`] = `
28-
[
29-
"Attempting to get step names for Run IDs: [0]",
30-
]
31-
`;
32-
33-
exports[`return-dispatch > handleAction > getRunIdAndUrl > should call retryOrTimeout with the larger workflowTimeoutMs timeout value 3`] = `
34-
[
35-
"Attempting to identify run ID from steps...",
36-
]
37-
`;
3+
exports[`return-dispatch > handleAction > getRunIdAndUrl > called fetchWorkflowRunIds with the provided workflowId and branch 1`] = `"Attempting to identify run ID for workflow.yml (123)"`;
4+
5+
exports[`return-dispatch > handleAction > getRunIdAndUrl > called fetchWorkflowRunIds with the provided workflowId and branch 2`] = `"Attempting to get step names for Run IDs: [0]"`;
6+
7+
exports[`return-dispatch > handleAction > getRunIdAndUrl > called fetchWorkflowRunIds with the provided workflowId and branch 3`] = `"Attempting to identify run ID from steps..."`;
8+
9+
exports[`return-dispatch > handleAction > getRunIdAndUrl > should call retryOrTimeout with the larger workflowTimeoutMs timeout value 1`] = `"Attempting to identify run ID for workflow.yml (123)"`;
10+
11+
exports[`return-dispatch > handleAction > getRunIdAndUrl > should call retryOrTimeout with the larger workflowTimeoutMs timeout value 2`] = `"Attempting to get step names for Run IDs: [0]"`;
12+
13+
exports[`return-dispatch > handleAction > getRunIdAndUrl > should call retryOrTimeout with the larger workflowTimeoutMs timeout value 3`] = `"Attempting to identify run ID from steps..."`;
3814

3915
exports[`return-dispatch > handleAction > getRunIdAndUrl > should retry until an ID is found 1`] = `"Attempting to identify run ID from steps..."`;
4016

@@ -46,35 +22,15 @@ exports[`return-dispatch > handleAction > getRunIdAndUrl > should retry until an
4622

4723
exports[`return-dispatch > handleAction > getRunIdAndUrl > should retry until an ID is found 5`] = `"Attempting to get step names for Run IDs: [0]"`;
4824

49-
exports[`return-dispatch > handleAction > getRunIdAndUrl > should return the ID when found 1`] = `
50-
[
51-
"Attempting to identify run ID for workflow.yml (123)",
52-
]
53-
`;
54-
55-
exports[`return-dispatch > handleAction > getRunIdAndUrl > should return the ID when found 2`] = `
56-
[
57-
"Attempting to get step names for Run IDs: [0]",
58-
]
59-
`;
60-
61-
exports[`return-dispatch > handleAction > getRunIdAndUrl > should return the ID when found 3`] = `
62-
[
63-
"Attempting to identify run ID from steps...",
64-
]
65-
`;
66-
67-
exports[`return-dispatch > handleAction > getRunIdAndUrl > should timeout when unable failing to get the run IDs 1`] = `
68-
[
69-
"Attempting to identify run ID for workflow.yml (123)",
70-
]
71-
`;
72-
73-
exports[`return-dispatch > handleAction > getRunIdAndUrl > should timeout when unable failing to get the run IDs 2`] = `
74-
[
75-
"Attempting to identify run ID from steps...",
76-
]
77-
`;
25+
exports[`return-dispatch > handleAction > getRunIdAndUrl > should return the ID when found 1`] = `"Attempting to identify run ID for workflow.yml (123)"`;
26+
27+
exports[`return-dispatch > handleAction > getRunIdAndUrl > should return the ID when found 2`] = `"Attempting to get step names for Run IDs: [0]"`;
28+
29+
exports[`return-dispatch > handleAction > getRunIdAndUrl > should return the ID when found 3`] = `"Attempting to identify run ID from steps..."`;
30+
31+
exports[`return-dispatch > handleAction > getRunIdAndUrl > should timeout when unable failing to get the run IDs 1`] = `"Attempting to identify run ID for workflow.yml (123)"`;
32+
33+
exports[`return-dispatch > handleAction > getRunIdAndUrl > should timeout when unable failing to get the run IDs 2`] = `"Attempting to identify run ID from steps..."`;
7834

7935
exports[`return-dispatch > handleAction > getRunIdAndUrl > should timeout when unable to find over time 1`] = `"Attempting to identify run ID from steps..."`;
8036

src/return-dispatch.spec.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,11 @@ describe("return-dispatch", () => {
549549
// Logging
550550
assertOnlyCalled(coreDebugLogMock, coreInfoLogMock);
551551
expect(coreDebugLogMock).toHaveBeenCalledTimes(2);
552-
expect(coreDebugLogMock.mock.calls[0]).toMatchSnapshot();
553-
expect(coreDebugLogMock.mock.calls[1]).toMatchSnapshot();
552+
expect(coreDebugLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
553+
expect(coreDebugLogMock.mock.calls[1]?.[0]).toMatchSnapshot();
554554

555555
expect(coreInfoLogMock).toHaveBeenCalledOnce();
556-
expect(coreInfoLogMock.mock.calls[0]).toMatchSnapshot();
556+
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
557557
});
558558

559559
it("should call retryOrTimeout with the larger WORKFLOW_FETCH_TIMEOUT_MS timeout value", async () => {
@@ -627,11 +627,11 @@ describe("return-dispatch", () => {
627627
// Logging
628628
assertOnlyCalled(coreDebugLogMock, coreInfoLogMock);
629629
expect(coreDebugLogMock).toHaveBeenCalledTimes(2);
630-
expect(coreDebugLogMock.mock.calls[0]).toMatchSnapshot();
631-
expect(coreDebugLogMock.mock.calls[1]).toMatchSnapshot();
630+
expect(coreDebugLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
631+
expect(coreDebugLogMock.mock.calls[1]?.[0]).toMatchSnapshot();
632632

633633
expect(coreInfoLogMock).toHaveBeenCalledOnce();
634-
expect(coreInfoLogMock.mock.calls[0]).toMatchSnapshot();
634+
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
635635
});
636636

637637
it("called fetchWorkflowRunIds with the provided workflowId and branch", async () => {
@@ -662,11 +662,11 @@ describe("return-dispatch", () => {
662662
// Logging
663663
assertOnlyCalled(coreDebugLogMock, coreInfoLogMock);
664664
expect(coreDebugLogMock).toHaveBeenCalledTimes(2);
665-
expect(coreDebugLogMock.mock.calls[0]).toMatchSnapshot();
666-
expect(coreDebugLogMock.mock.calls[1]).toMatchSnapshot();
665+
expect(coreDebugLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
666+
expect(coreDebugLogMock.mock.calls[1]?.[0]).toMatchSnapshot();
667667

668668
expect(coreInfoLogMock).toHaveBeenCalledOnce();
669-
expect(coreInfoLogMock.mock.calls[0]).toMatchSnapshot();
669+
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
670670
});
671671

672672
it("should retry until an ID is found", async () => {
@@ -782,13 +782,13 @@ describe("return-dispatch", () => {
782782
// Logging
783783
assertOnlyCalled(coreDebugLogMock, coreInfoLogMock);
784784
expect(coreDebugLogMock).toHaveBeenCalledTimes(2);
785-
expect(coreDebugLogMock.mock.calls[0]).toMatchSnapshot();
785+
expect(coreDebugLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
786786
expect(coreDebugLogMock.mock.calls[1]?.[0]).toMatch(
787787
/Timed out while attempting to fetch Workflow Run IDs, waited [0-9]+ms/,
788788
);
789789

790790
expect(coreInfoLogMock).toHaveBeenCalledOnce();
791-
expect(coreInfoLogMock.mock.calls[0]).toMatchSnapshot();
791+
expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchSnapshot();
792792
});
793793

794794
it("should timeout when unable to find over time", async () => {

src/return-dispatch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ActionOutputs } from "./action.ts";
44
import * as api from "./api.ts";
55
import * as constants from "./constants.ts";
66
import type { Result } from "./types.ts";
7-
import { escapeRegExp, sleep, type BranchNameResult } from "./utils.ts";
7+
import { sleep, type BranchNameResult } from "./utils.ts";
88

99
export function shouldRetryOrThrow(
1010
error: Error,

0 commit comments

Comments
 (0)