Handle the case where branches may be strings, including "*"

This commit is contained in:
Simon Engledew 2020-12-01 10:42:21 +00:00
parent c6dbd5a9bf
commit ac1c081de8
No known key found for this signature in database
GPG key ID: 84302E7B02FE8BCE
6 changed files with 66 additions and 13 deletions

View file

@ -112,6 +112,18 @@ ava_1.default("validateWorkflow() when on.push is a correct object", (t) => {
});
t.deepEqual(errors.length, 0);
});
ava_1.default("validateWorkflow() when on.pull_requests is a string", (t) => {
const errors = actionsutil.validateWorkflow({
on: { push: { branches: ["main"] }, pull_request: { branches: "*" } },
});
t.deepEqual(errors, [actionsutil.WorkflowErrors.MismatchedBranches]);
});
ava_1.default("validateWorkflow() when on.pull_requests is a string and correct", (t) => {
const errors = actionsutil.validateWorkflow({
on: { push: { branches: "*" }, pull_request: { branches: "*" } },
});
t.deepEqual(errors, []);
});
ava_1.default("validateWorkflow() when on.push is correct with empty objects", (t) => {
const errors = actionsutil.validateWorkflow({
on: { push: undefined, pull_request: undefined },