From 79c0cc7c0bec2419725a656f8314f11c21899821 Mon Sep 17 00:00:00 2001 From: Amiel Martin Date: Wed, 15 Sep 2021 10:14:24 -0800 Subject: [PATCH] Include a test for branching --- __tests__/fixtures/branches.yml | 3 +++ __tests__/main.test.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/__tests__/fixtures/branches.yml b/__tests__/fixtures/branches.yml index cdf9551d..b72c67f2 100644 --- a/__tests__/fixtures/branches.yml +++ b/__tests__/fixtures/branches.yml @@ -3,3 +3,6 @@ test-branch: feature-branch: - branch: "*/feature/*" + +bug-branch: + - branch: "{bug,fix}/*" diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 1c61fc14..85e85f4c 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -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 {