feat(issue-41): set and inherit labels (#48)

fix https://github.com/kiegroup/git-backporting/issues/41
This commit is contained in:
Andrea Lamparelli 2023-07-10 08:49:11 +02:00 committed by GitHub
parent f923f7f4c2
commit fcc01673f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 962 additions and 140 deletions

View file

@ -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"]);
});
});