mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-11 03:00:26 +01:00
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:
1 parent
2d95239f93
commit
7da2d98d9d
1 file changed
+3
-2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user