Skip to content

Commit 13db4fc

Browse files
committed
fix(test): lint-clean pr-ci-sweeper runner fakes
1 parent 1e79b0f commit 13db4fc

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

test/scripts/pr-ci-sweeper.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,40 +136,40 @@ function fakeGithub(options: {
136136
calls.push({ method, args });
137137
};
138138
const github = {
139-
paginate: (endpoint: { __name: string }, args: Record<string, unknown>) => {
140-
record(endpoint.__name, args);
141-
if (endpoint.__name === "pulls.list") {
139+
paginate: (endpoint: { endpointName: string }, args: Record<string, unknown>) => {
140+
record(endpoint.endpointName, args);
141+
if (endpoint.endpointName === "pulls.list") {
142142
return Promise.resolve(options.prs);
143143
}
144-
if (endpoint.__name === "actions.listWorkflowRuns") {
144+
if (endpoint.endpointName === "actions.listWorkflowRuns") {
145145
return Promise.resolve(
146146
(options.runsBySha[args.head_sha as string] ?? []).map((run) => ({
147-
event: "pull_request",
148-
...run,
147+
event: run.event ?? "pull_request",
148+
conclusion: run.conclusion,
149149
})),
150150
);
151151
}
152-
if (endpoint.__name === "issues.listEvents") {
152+
if (endpoint.endpointName === "issues.listEvents") {
153153
return Promise.resolve(options.events ?? []);
154154
}
155-
throw new Error(`unexpected paginate ${endpoint.__name}`);
155+
throw new Error(`unexpected paginate ${endpoint.endpointName}`);
156156
},
157157
rest: {
158158
pulls: {
159-
list: { __name: "pulls.list" },
159+
list: { endpointName: "pulls.list" },
160160
get: (args: Record<string, unknown>) => {
161161
record("pulls.get", args);
162-
const pr = options.prs.find((entry) => entry.number === args.pull_number);
163-
return Promise.resolve({ data: pr });
162+
const match = options.prs.find((entry) => entry.number === args.pull_number);
163+
return Promise.resolve({ data: match });
164164
},
165165
update: (args: Record<string, unknown>) => {
166166
record("pulls.update", args);
167167
return Promise.resolve({});
168168
},
169169
},
170-
actions: { listWorkflowRuns: { __name: "actions.listWorkflowRuns" } },
170+
actions: { listWorkflowRuns: { endpointName: "actions.listWorkflowRuns" } },
171171
issues: {
172-
listEvents: { __name: "issues.listEvents" },
172+
listEvents: { endpointName: "issues.listEvents" },
173173
createComment: (args: Record<string, unknown>) => {
174174
record("issues.createComment", args);
175175
return Promise.resolve({});

0 commit comments

Comments
 (0)