Add tests for array branh labelling

This commit is contained in:
Josh Dales
2021-09-29 10:32:05 -04:00
parent 2d63815c83
commit ab49f7a2bd
2 changed files with 17 additions and 0 deletions

View File

@@ -6,3 +6,6 @@ feature-branch:
bug-branch:
- branch: "{bug,fix}/*"
array-branch:
- branch: ["array/*", "*/array/*"]

View File

@@ -147,6 +147,20 @@ describe("run", () => {
labels: ["bug-branch"],
});
});
it("it can support multiple branches by providing an array", async () => {
github.context.payload.pull_request!.head = { ref: "array/123" };
usingLabelerConfigYaml("branches.yml");
await run();
expect(addLabelsMock).toHaveBeenCalledTimes(1);
expect(addLabelsMock).toHaveBeenCalledWith({
owner: "monalisa",
repo: "helloworld",
issue_number: 123,
labels: ["array-branch"],
});
});
});
function usingLabelerConfigYaml(fixtureName: keyof typeof yamlFixtures): void {