From d4fb89399cff2b1ca391401ff93005750e557aa8 Mon Sep 17 00:00:00 2001 From: Peter Schilling Date: Tue, 3 Mar 2026 16:30:11 +0000 Subject: [PATCH] test: add issue update -p priority test and regenerate skill docs - Add snapshot test for 'issue update -p ' to verify -p maps to --priority (not --parent), mirroring the fix tested in issue create - Regenerate skill docs to reflect corrected flag assignments: --parent (no short flag) and -p, --priority --- skills/linear-cli/references/issue.md | 8 +- src/commands/issue/issue-create.ts | 4 +- src/commands/issue/issue-update.ts | 4 +- .../__snapshots__/issue-create.test.ts.snap | 14 ++- .../__snapshots__/issue-update.test.ts.snap | 15 +++- test/commands/issue/issue-create.test.ts | 87 +++++++++++++++++++ test/commands/issue/issue-update.test.ts | 66 ++++++++++++++ 7 files changed, 186 insertions(+), 12 deletions(-) diff --git a/skills/linear-cli/references/issue.md b/skills/linear-cli/references/issue.md index 3c970177..79dc85d7 100644 --- a/skills/linear-cli/references/issue.md +++ b/skills/linear-cli/references/issue.md @@ -270,8 +270,8 @@ Options: --start - Start the issue after creation -a, --assignee - Assign the issue to 'self' or someone (by username or name) --due-date - Due date of the issue - -p, --parent - Parent issue (if any) as a team_number code - --priority - Priority of the issue (1-4, descending priority) + --parent - Parent issue (if any) as a team_number code + -p, --priority - Priority of the issue (1-4, descending priority) --estimate - Points estimate of the issue -d, --description - Description of the issue --description-file - Read description from a file (preferred for markdown content) @@ -304,8 +304,8 @@ Options: -w, --workspace - Target workspace (uses credentials) -a, --assignee - Assign the issue to 'self' or someone (by username or name) --due-date - Due date of the issue - -p, --parent - Parent issue (if any) as a team_number code - --priority - Priority of the issue (1-4, descending priority) + --parent - Parent issue (if any) as a team_number code + -p, --priority - Priority of the issue (1-4, descending priority) --estimate - Points estimate of the issue -d, --description - Description of the issue --description-file - Read description from a file (preferred for markdown content) diff --git a/src/commands/issue/issue-create.ts b/src/commands/issue/issue-create.ts index bd2c274a..d9f37b29 100644 --- a/src/commands/issue/issue-create.ts +++ b/src/commands/issue/issue-create.ts @@ -460,11 +460,11 @@ export const createCommand = new Command() "Due date of the issue", ) .option( - "-p, --parent ", + "--parent ", "Parent issue (if any) as a team_number code", ) .option( - "--priority ", + "-p, --priority ", "Priority of the issue (1-4, descending priority)", ) .option( diff --git a/src/commands/issue/issue-update.ts b/src/commands/issue/issue-update.ts index 7756fd6e..1487516f 100644 --- a/src/commands/issue/issue-update.ts +++ b/src/commands/issue/issue-update.ts @@ -33,11 +33,11 @@ export const updateCommand = new Command() "Due date of the issue", ) .option( - "-p, --parent ", + "--parent ", "Parent issue (if any) as a team_number code", ) .option( - "--priority ", + "-p, --priority ", "Priority of the issue (1-4, descending priority)", ) .option( diff --git a/test/commands/issue/__snapshots__/issue-create.test.ts.snap b/test/commands/issue/__snapshots__/issue-create.test.ts.snap index c99fca96..729a7283 100644 --- a/test/commands/issue/__snapshots__/issue-create.test.ts.snap +++ b/test/commands/issue/__snapshots__/issue-create.test.ts.snap @@ -15,8 +15,8 @@ Options: --start - Start the issue after creation -a, --assignee - Assign the issue to 'self' or someone (by username or name) --due-date - Due date of the issue - -p, --parent - Parent issue (if any) as a team_number code - --priority - Priority of the issue (1-4, descending priority) + --parent - Parent issue (if any) as a team_number code + -p, --priority - Priority of the issue (1-4, descending priority) --estimate - Points estimate of the issue -d, --description - Description of the issue --description-file - Read description from a file (preferred for markdown content) @@ -65,6 +65,16 @@ stderr: "" `; +snapshot[`Issue Create Command - Short Flag -p Is Priority 1`] = ` +stdout: +"Creating issue in ENG + +https://linear.app/test-team/issue/ENG-999/test-priority-flag +" +stderr: +"" +`; + snapshot[`Issue Create Command - With Cycle 1`] = ` stdout: "Creating issue in ENG diff --git a/test/commands/issue/__snapshots__/issue-update.test.ts.snap b/test/commands/issue/__snapshots__/issue-update.test.ts.snap index a8febb58..74280470 100644 --- a/test/commands/issue/__snapshots__/issue-update.test.ts.snap +++ b/test/commands/issue/__snapshots__/issue-update.test.ts.snap @@ -14,8 +14,8 @@ Options: -h, --help - Show this help. -a, --assignee - Assign the issue to 'self' or someone (by username or name) --due-date - Due date of the issue - -p, --parent - Parent issue (if any) as a team_number code - --priority - Priority of the issue (1-4, descending priority) + --parent - Parent issue (if any) as a team_number code + -p, --priority - Priority of the issue (1-4, descending priority) --estimate - Points estimate of the issue -d, --description - Description of the issue --description-file - Read description from a file (preferred for markdown content) @@ -65,6 +65,17 @@ stderr: "" `; +snapshot[`Issue Update Command - Short Flag -p Is Priority 1`] = ` +stdout: +"Updating issue ENG-123 + +✓ Updated issue ENG-123: Test Issue +https://linear.app/test-team/issue/ENG-123/test-issue +" +stderr: +"" +`; + snapshot[`Issue Update Command - With Cycle 1`] = ` stdout: "Updating issue ENG-123 diff --git a/test/commands/issue/issue-create.test.ts b/test/commands/issue/issue-create.test.ts index e448f2ee..17811fb6 100644 --- a/test/commands/issue/issue-create.test.ts +++ b/test/commands/issue/issue-create.test.ts @@ -260,6 +260,93 @@ await snapshotTest({ }, }) +// Test that -p is priority (not parent), resolving the flag conflict +await snapshotTest({ + name: "Issue Create Command - Short Flag -p Is Priority", + meta: import.meta, + colors: false, + args: [ + "--title", + "Test priority flag", + "--team", + "ENG", + "-p", + "2", + "--parent", + "ENG-220", + "--no-interactive", + ], + denoArgs: commonDenoArgs, + async fn() { + const { cleanup } = await setupMockLinearServer([ + // Mock response for getTeamIdByKey() + { + queryName: "GetTeamIdByKey", + variables: { team: "ENG" }, + response: { + data: { + teams: { + nodes: [{ id: "team-eng-id" }], + }, + }, + }, + }, + // Mock response for getIssueId("ENG-220") - resolves parent identifier to ID + { + queryName: "GetIssueId", + variables: { id: "ENG-220" }, + response: { + data: { + issue: { + id: "parent-issue-id", + }, + }, + }, + }, + // Mock response for fetchParentIssueData("parent-issue-id") + { + queryName: "GetParentIssueData", + variables: { id: "parent-issue-id" }, + response: { + data: { + issue: { + title: "Parent Issue", + identifier: "ENG-220", + project: null, + }, + }, + }, + }, + // Mock response for the create issue mutation + { + queryName: "CreateIssue", + response: { + data: { + issueCreate: { + success: true, + issue: { + id: "issue-new-priority", + identifier: "ENG-999", + url: + "https://linear.app/test-team/issue/ENG-999/test-priority-flag", + team: { + key: "ENG", + }, + }, + }, + }, + }, + }, + ], { LINEAR_TEAM_ID: "ENG" }) + + try { + await createCommand.parse() + } finally { + await cleanup() + } + }, +}) + // Test creating an issue with cycle await snapshotTest({ name: "Issue Create Command - With Cycle", diff --git a/test/commands/issue/issue-update.test.ts b/test/commands/issue/issue-update.test.ts index 5f9f7017..275a18b4 100644 --- a/test/commands/issue/issue-update.test.ts +++ b/test/commands/issue/issue-update.test.ts @@ -240,6 +240,72 @@ await snapshotTest({ }, }) +// Test that -p is priority (not parent), resolving the flag conflict +await snapshotTest({ + name: "Issue Update Command - Short Flag -p Is Priority", + meta: import.meta, + colors: false, + args: [ + "ENG-123", + "-p", + "2", + "--parent", + "ENG-220", + ], + denoArgs: commonDenoArgs, + async fn() { + const { cleanup } = await setupMockLinearServer([ + // Mock response for getTeamIdByKey() + { + queryName: "GetTeamIdByKey", + variables: { team: "ENG" }, + response: { + data: { + teams: { + nodes: [{ id: "team-eng-id" }], + }, + }, + }, + }, + // Mock response for getIssueId("ENG-220") - resolves parent identifier to ID + { + queryName: "GetIssueId", + variables: { id: "ENG-220" }, + response: { + data: { + issue: { + id: "parent-issue-id", + }, + }, + }, + }, + // Mock response for the update issue mutation + { + queryName: "UpdateIssue", + response: { + data: { + issueUpdate: { + success: true, + issue: { + id: "issue-existing-123", + identifier: "ENG-123", + url: "https://linear.app/test-team/issue/ENG-123/test-issue", + title: "Test Issue", + }, + }, + }, + }, + }, + ], { LINEAR_TEAM_ID: "ENG" }) + + try { + await updateCommand.parse() + } finally { + await cleanup() + } + }, +}) + // Test updating an issue with cycle await snapshotTest({ name: "Issue Update Command - With Cycle",