Skip to content

Commit 35ef6a2

Browse files
committed
Move formatGitHubVersion into util.test.ts
1 parent 5227afa commit 35ef6a2

6 files changed

Lines changed: 30 additions & 31 deletions

File tree

lib/util.js

Lines changed: 1 addition & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.test.js

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/util.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,19 @@ test("isGitHubGhesVersionBelow", async (t) => {
394394
);
395395
});
396396

397+
function formatGitHubVersion(version: util.GitHubVersion): string {
398+
switch (version.type) {
399+
case util.GitHubVariant.DOTCOM:
400+
return "dotcom";
401+
case util.GitHubVariant.GHAE:
402+
return "GHAE";
403+
case util.GitHubVariant.GHES:
404+
return `GHES ${version.version}`;
405+
default:
406+
util.assertNever(version);
407+
}
408+
}
409+
397410
const CHECK_ACTION_VERSION_TESTS: Array<[string, util.GitHubVersion, boolean]> =
398411
[
399412
["1.2.1", { type: util.GitHubVariant.DOTCOM }, true],
@@ -416,7 +429,7 @@ for (const [
416429
const reportWarningDescription = shouldReportWarning
417430
? "reports warning"
418431
: "doesn't report warning";
419-
const versionsDescription = `CodeQL Action version ${version} and GitHub version ${util.formatGitHubVersion(
432+
const versionsDescription = `CodeQL Action version ${version} and GitHub version ${formatGitHubVersion(
420433
githubVersion
421434
)}`;
422435
test(`checkActionVersion ${reportWarningDescription} for ${versionsDescription}`, async (t) => {

src/util.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -738,16 +738,3 @@ export async function checkActionVersion(version: string) {
738738
}
739739
}
740740
}
741-
742-
export function formatGitHubVersion(version: GitHubVersion): string {
743-
switch (version.type) {
744-
case GitHubVariant.DOTCOM:
745-
return "dotcom";
746-
case GitHubVariant.GHAE:
747-
return "GHAE";
748-
case GitHubVariant.GHES:
749-
return `GHES ${version.version}`;
750-
default:
751-
assertNever(version);
752-
}
753-
}

0 commit comments

Comments
 (0)