Add more wildcard examples

This commit is contained in:
Simon Engledew 2020-12-01 15:33:27 +00:00
parent 14719432ef
commit 145a3c1ed9
No known key found for this signature in database
GPG key ID: 84302E7B02FE8BCE
3 changed files with 31 additions and 4 deletions

View file

@ -216,5 +216,14 @@ ava_1.default("formatWorkflowCause()", (t) => {
ava_1.default("patternsOverlap()", (t) => {
t.false(actionsutil.patternsOverlap("main-*", "main"));
t.true(actionsutil.patternsOverlap("*", "*"));
t.true(actionsutil.patternsOverlap("*", "main-*"));
t.false(actionsutil.patternsOverlap("main-*", "*"));
t.false(actionsutil.patternsOverlap("main-*", "main"));
t.true(actionsutil.patternsOverlap("main", "main"));
t.false(actionsutil.patternsOverlap("*", "feature/*"));
t.true(actionsutil.patternsOverlap("**", "feature/*"));
t.false(actionsutil.patternsOverlap("feature-*", "**"));
t.true(actionsutil.patternsOverlap("/robin/*/release/*", "/robin/moose/release/goose"));
t.false(actionsutil.patternsOverlap("/robin/moose/release/goose", "/robin/*/release/*"));
});
//# sourceMappingURL=actions-util.test.js.map

File diff suppressed because one or more lines are too long

View file

@ -217,19 +217,18 @@ test("validateWorkflow() when on.pull_request for wildcard branches", (t) => {
const errors = actionsutil.validateWorkflow({
on: {
push: { branches: ["feature/*"] },
pull_request: {branches: "feature/moose"},
pull_request: { branches: "feature/moose" },
},
});
t.deepEqual(errors, []);
});
test("validateWorkflow() when on.pull_request for mismatched wildcard branches", (t) => {
const errors = actionsutil.validateWorkflow({
on: {
push: { branches: ["feature/moose"] },
pull_request: {branches: "feature/*"},
pull_request: { branches: "feature/*" },
},
});
@ -273,4 +272,23 @@ test("formatWorkflowCause()", (t) => {
test("patternsOverlap()", (t) => {
t.false(actionsutil.patternsOverlap("main-*", "main"));
t.true(actionsutil.patternsOverlap("*", "*"));
t.true(actionsutil.patternsOverlap("*", "main-*"));
t.false(actionsutil.patternsOverlap("main-*", "*"));
t.false(actionsutil.patternsOverlap("main-*", "main"));
t.true(actionsutil.patternsOverlap("main", "main"));
t.false(actionsutil.patternsOverlap("*", "feature/*"));
t.true(actionsutil.patternsOverlap("**", "feature/*"));
t.false(actionsutil.patternsOverlap("feature-*", "**"));
t.true(
actionsutil.patternsOverlap(
"/robin/*/release/*",
"/robin/moose/release/goose"
)
);
t.false(
actionsutil.patternsOverlap(
"/robin/moose/release/goose",
"/robin/*/release/*"
)
);
});