mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-06-28 13:43:48 +00:00
feat(issue-41): set and inherit labels (#48)
fix https://github.com/kiegroup/git-backporting/issues/41
This commit is contained in:
parent
f923f7f4c2
commit
fcc01673f4
28 changed files with 962 additions and 140 deletions
|
@ -1,5 +1,6 @@
|
|||
import { parseArgs, readConfigFile } from "@bp/service/args/args-utils";
|
||||
import { createTestFile, removeTestFile } from "../../support/utils";
|
||||
import { getAsCleanedCommaSeparatedList, getAsCommaSeparatedList, getOrUndefined, parseArgs, readConfigFile } from "@bp/service/args/args-utils";
|
||||
import { createTestFile, expectArrayEqual, removeTestFile, spyGetInput } from "../../support/utils";
|
||||
import { getInput } from "@actions/core";
|
||||
|
||||
const RANDOM_CONFIG_FILE_CONTENT_PATHNAME = "./args-utils-test-random-config-file.json";
|
||||
const RANDOM_CONFIG_FILE_CONTENT = {
|
||||
|
@ -39,4 +40,39 @@ describe("args utils test suite", () => {
|
|||
test("check readConfigFile function", () => {
|
||||
expect(readConfigFile(RANDOM_CONFIG_FILE_CONTENT_PATHNAME)).toStrictEqual(RANDOM_CONFIG_FILE_CONTENT);
|
||||
});
|
||||
|
||||
test("gha getOrUndefined", () => {
|
||||
spyGetInput({
|
||||
"present": "value",
|
||||
"empty": "",
|
||||
});
|
||||
expect(getOrUndefined(getInput("empty"))).toStrictEqual(undefined);
|
||||
expect(getOrUndefined(getInput("present"))).toStrictEqual("value");
|
||||
});
|
||||
|
||||
test("gha getAsCleanedCommaSeparatedList", () => {
|
||||
spyGetInput({
|
||||
"present": "value1, value2 , value3",
|
||||
"empty": "",
|
||||
"blank": " ",
|
||||
"inner": " inner spaces ",
|
||||
});
|
||||
expectArrayEqual(getAsCleanedCommaSeparatedList(getInput("present"))!, ["value1", "value2", "value3"]);
|
||||
expect(getAsCleanedCommaSeparatedList(getInput("empty"))).toStrictEqual(undefined);
|
||||
expect(getAsCleanedCommaSeparatedList(getInput("blank"))).toStrictEqual(undefined);
|
||||
expect(getAsCleanedCommaSeparatedList(getInput("inner"))).toStrictEqual(["innerspaces"]);
|
||||
});
|
||||
|
||||
test("gha getAsCommaSeparatedList", () => {
|
||||
spyGetInput({
|
||||
"present": "value1, value2 , value3",
|
||||
"empty": "",
|
||||
"blank": " ",
|
||||
"inner": " inner spaces ",
|
||||
});
|
||||
expectArrayEqual(getAsCommaSeparatedList(getInput("present"))!, ["value1", "value2", "value3"]);
|
||||
expect(getAsCommaSeparatedList(getInput("empty"))).toStrictEqual(undefined);
|
||||
expect(getAsCommaSeparatedList(getInput("blank"))).toStrictEqual(undefined);
|
||||
expectArrayEqual(getAsCommaSeparatedList(getInput("inner"))!, ["inner spaces"]);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue