Add another test to make sure that partial branch naming works

This commit is contained in:
Josh Dales
2021-08-07 15:20:20 -04:00
parent ee0e0eb513
commit a01b9aebb2
2 changed files with 15 additions and 1 deletions

View File

@@ -8,7 +8,6 @@ export const context = {
owner: "monalisa", owner: "monalisa",
repo: "helloworld", repo: "helloworld",
}, },
ref: "test/testing-time",
}; };
const mockApi = { const mockApi = {

View File

@@ -105,6 +105,7 @@ describe("run", () => {
}); });
it("adds labels based on the branch names that match the glob pattern", async () => { it("adds labels based on the branch names that match the glob pattern", async () => {
github.context.ref = "test/testing-time";
usingLabelerConfigYaml("branches.yml"); usingLabelerConfigYaml("branches.yml");
await run(); await run();
@@ -116,6 +117,20 @@ describe("run", () => {
labels: ["test-branch"], labels: ["test-branch"],
}); });
}); });
it("adds labels based on branch names that match the glob pattern", async () => {
github.context.ref = "my/feature/that-i-like";
usingLabelerConfigYaml("branches.yml");
await run();
expect(addLabelsMock).toHaveBeenCalledTimes(1);
expect(addLabelsMock).toHaveBeenCalledWith({
owner: "monalisa",
repo: "helloworld",
issue_number: 123,
labels: ["feature-branch"],
});
});
}); });
function usingLabelerConfigYaml(fixtureName: keyof typeof yamlFixtures): void { function usingLabelerConfigYaml(fixtureName: keyof typeof yamlFixtures): void {