test(pr-wait): function declarations for the fake-gh helpers so the pregate TSX import scanner maps the lib files

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-26 21:33:57 +00:00
1 parent 2d95239f93
commit 7da2d98d9d
1 file changed
+3 -2
+3 -2
View File
@@ -63,10 +63,11 @@ interface Script {
behind?: GhResult;
}
function fakeGh(script: Script) {
const queue = <T>(value: T | T[] | undefined): T[] => (value === undefined ? [] : Array.isArray(value) ? [...value] : [value]);
// Function declarations, not generic arrows: pregate's import scanner reads tests as TSX, where `<T>(x) =>` is a tag.
function queue<T>(value: T | T[] | undefined): T[] { return value === undefined ? [] : Array.isArray(value) ? [...value] : [value]; }
function next<T>(q: T[]): T | undefined { return q.length > 1 ? q.shift() : q[0]; }
const prs = queue(script.pr).map(ok);
const checks = queue(script.checks);
const next = <T>(q: T[]): T | undefined => (q.length > 1 ? q.shift() : q[0]);
const calls: string[][] = [];
const gh = (args: string[]): GhResult => {
calls.push(args);