mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Add tests
This commit is contained in:
@@ -688,6 +688,12 @@ test("getCredentials always returns ALWAYS_ENABLED_REGISTRY_TYPE credentials for
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("getProxyPackage - includes platform in name", (t) => {
|
||||||
|
for (const platform of Object.values(BundlePlatform)) {
|
||||||
|
t.true(startProxyExports.getProxyPackage(platform).includes(platform));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function mockGetApiClient(endpoints: any) {
|
function mockGetApiClient(endpoints: any) {
|
||||||
return (
|
return (
|
||||||
sinon
|
sinon
|
||||||
@@ -731,6 +737,37 @@ function getTestPlatform(action: ActionState<["Base"]>) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test.serial(
|
||||||
|
"getDownloadUrl logs unknown platforms/arch and defaults to linux64",
|
||||||
|
async (t) => {
|
||||||
|
const logger = new RecordingLogger();
|
||||||
|
mockGetReleaseByTag();
|
||||||
|
|
||||||
|
await withTmpDir(async (tempDir) => {
|
||||||
|
const features = mockOfflineFeatures(tempDir, logger);
|
||||||
|
const state = initAllState({
|
||||||
|
platform: "android",
|
||||||
|
arch: "ppc",
|
||||||
|
logger,
|
||||||
|
features,
|
||||||
|
});
|
||||||
|
const info = await startProxyExports.getDownloadUrl(state);
|
||||||
|
|
||||||
|
t.is(info.version, startProxyExports.UPDATEJOB_PROXY_VERSION);
|
||||||
|
t.is(
|
||||||
|
info.url,
|
||||||
|
startProxyExports.getFallbackUrl(
|
||||||
|
startProxyExports.getProxyPackage(BundlePlatform.Linux64),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
t.true(
|
||||||
|
logger.hasMessage(`Unsupported platform android on architecture ppc`),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
test.serial(
|
test.serial(
|
||||||
"getDownloadUrl returns fallback when `getReleaseByVersion` rejects",
|
"getDownloadUrl returns fallback when `getReleaseByVersion` rejects",
|
||||||
async (t) => {
|
async (t) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user