Add more test cases

This commit is contained in:
Simon Engledew 2020-12-01 15:30:11 +00:00
parent c8ee1f4ef3
commit 14719432ef
No known key found for this signature in database
GPG key ID: 84302E7B02FE8BCE
3 changed files with 42 additions and 1 deletions

View file

@ -167,6 +167,24 @@ ava_1.default("validateWorkflow() when on.pull_request for every branch but push
});
t.deepEqual(errors, [actionsutil.WorkflowErrors.MismatchedBranches]);
});
ava_1.default("validateWorkflow() when on.pull_request for wildcard branches", (t) => {
const errors = actionsutil.validateWorkflow({
on: {
push: { branches: ["feature/*"] },
pull_request: { branches: "feature/moose" },
},
});
t.deepEqual(errors, []);
});
ava_1.default("validateWorkflow() when on.pull_request for mismatched wildcard branches", (t) => {
const errors = actionsutil.validateWorkflow({
on: {
push: { branches: ["feature/moose"] },
pull_request: { branches: "feature/*" },
},
});
t.deepEqual(errors, [actionsutil.WorkflowErrors.MismatchedBranches]);
});
ava_1.default("validateWorkflow() when HEAD^2 is checked out", (t) => {
const errors = actionsutil.validateWorkflow({
on: ["push", "pull_request"],

File diff suppressed because one or more lines are too long

View file

@ -213,6 +213,29 @@ test("validateWorkflow() when on.pull_request for every branch but push specifie
t.deepEqual(errors, [actionsutil.WorkflowErrors.MismatchedBranches]);
});
test("validateWorkflow() when on.pull_request for wildcard branches", (t) => {
const errors = actionsutil.validateWorkflow({
on: {
push: { branches: ["feature/*"] },
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/*"},
},
});
t.deepEqual(errors, [actionsutil.WorkflowErrors.MismatchedBranches]);
});
test("validateWorkflow() when HEAD^2 is checked out", (t) => {
const errors = actionsutil.validateWorkflow({
on: ["push", "pull_request"],