Include a test for branching

This commit is contained in:
Amiel Martin
2021-09-15 10:14:24 -08:00
parent d9ed3e87f6
commit 79c0cc7c0b
2 changed files with 17 additions and 0 deletions

View File

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

View File

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