Move makeVersionOutput to testing-utils.js
This commit is contained in:
parent
a402be8739
commit
e827ad5b71
18 changed files with 110 additions and 114 deletions
|
|
@ -443,21 +443,6 @@ function resolveFunction<T>(
|
|||
return partialCodeql[methodName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a `VersionOutput` object for testing purposes only.
|
||||
*/
|
||||
export const makeVersionOutput = (version: string): VersionOutput => ({
|
||||
productName: "CodeQL",
|
||||
vendor: "GitHub",
|
||||
sha: "",
|
||||
branches: [],
|
||||
copyright: "",
|
||||
unpackedLocation: "",
|
||||
configFileLocation: "",
|
||||
configFileFound: false,
|
||||
version,
|
||||
});
|
||||
|
||||
/**
|
||||
* Set the functionality for CodeQL methods. Only for use in tests.
|
||||
*
|
||||
|
|
@ -470,7 +455,20 @@ export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
|
|||
getVersion: resolveFunction(
|
||||
partialCodeql,
|
||||
"getVersion",
|
||||
() => new Promise((resolve) => resolve(makeVersionOutput("1.0.0"))),
|
||||
() =>
|
||||
new Promise((resolve) =>
|
||||
resolve({
|
||||
productName: "CodeQL",
|
||||
vendor: "GitHub",
|
||||
sha: "",
|
||||
branches: [],
|
||||
copyright: "",
|
||||
unpackedLocation: "",
|
||||
configFileLocation: "",
|
||||
configFileFound: false,
|
||||
version: "1.0.0",
|
||||
}),
|
||||
),
|
||||
),
|
||||
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
||||
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue