Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/cli/test/lib/issue-arguments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ describe("parseIssueArgument", () => {
expect(parseIssueArgument(arg)).toEqual({ text: arg, parsed });
});

// CLI-1G1: agents pass a short ID and numeric ID (or several IDs) as one
// argument. That is a search, never "Invalid issue identifier: contains a
// space".
test.each([
["CLI-1G1 7441717161", "CLI-1G1 7441717161"],
["IOS-HK IOS-R3", "IOS-HK IOS-R3"],
[" login timeout ", "login timeout"],
])("searches for text with spaces: %j (CLI-1G1)", (arg, query) => {
expect(parseIssueArgument(arg)).toEqual({
text: arg,
parsed: { type: "search", query },
});
});

test("keeps the argument as typed and parses its first line", () => {
expect(parseIssueArgument("\n CLI-G \nCLI-H\n")).toEqual({
text: "\n CLI-G \nCLI-H\n",
Expand Down Expand Up @@ -159,6 +173,17 @@ describe("parseIssueArguments", () => {
]);
});

test("splits a short ID and numeric ID passed as one argument (CLI-1G1)", () => {
expect(
parseIssueArguments(["CLI-1G1 7441717161"], { usageHint }).map(
({ parsed }) => parsed,
),
).toEqual([
{ type: "project-search", projectSlug: "cli", suffix: "1G1" },
{ type: "numeric", id: "7441717161" },
]);
});

test("keeps repeated issues: the command decides", () => {
expect(texts(["IOS-1", "IOS-1"])).toEqual(["IOS-1", "IOS-1"]);
});
Expand Down
Loading