Skip to content

Commit b535178

Browse files
committed
add command: Add general labels when specific labels are added.
This adds the relevant general area labels whenever a specific area label is added with the "add" command. adds a test case for this feature Co-authored-by: Skyler Simpson Fixes #29739.
1 parent 60e763f commit b535178

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

test/unit/commands/add.js

+25-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ const payload = {
2121
},
2222
};
2323

24-
const repoLabels = [{ name: "test" }, { name: "test2" }, { name: "bug" }];
24+
const repoLabels = [
25+
{ name: "test" },
26+
{ name: "test2" },
27+
{ name: "bug" },
28+
{ name: "area: test (specific)" },
29+
{ name: "area: test" },
30+
];
2531

2632
const template = client.templates.get("labelError");
2733
template.content = "{labels} {labelList} {exist} {beState} {action} {type}.";
@@ -147,3 +153,21 @@ test("Add appropriate labels and reject already added labels", async () => {
147153

148154
scope.done();
149155
});
156+
157+
test("Add general label when specific label is added", async () => {
158+
client.cfg.issues.commands.label.self = false;
159+
const commenter = "octocat";
160+
const args = '"area: test (specific)"';
161+
162+
const scope = nock("https://api.github.com")
163+
.get("/repos/zulip/zulipbot/labels")
164+
.reply(200, repoLabels)
165+
.post("/repos/zulip/zulipbot/issues/69/labels", {
166+
labels: ["area: test (specific)", "area: test"],
167+
})
168+
.reply(200);
169+
170+
await add.run.call(client, payload, commenter, args);
171+
172+
scope.done();
173+
});

0 commit comments

Comments
 (0)