-
Notifications
You must be signed in to change notification settings - Fork 0
Show parsed ticket IDs in /list output #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -97,6 +97,56 @@ func TestMapMRStatusAndReportedAt(t *testing.T) { | |||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| func TestFormatItemDescriptionForList(t *testing.T) { | ||||||||||||||||||||||
| tests := []struct { | ||||||||||||||||||||||
| name string | ||||||||||||||||||||||
| item WorkItem | ||||||||||||||||||||||
| want string | ||||||||||||||||||||||
| }{ | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| name: "prepend single ticket id", | ||||||||||||||||||||||
| item: WorkItem{ | ||||||||||||||||||||||
| Description: "Tune query timeout for widget pipeline", | ||||||||||||||||||||||
| TicketIDs: "7003001", | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| want: "[7003001] Tune query timeout for widget pipeline", | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| name: "prepend comma list and trim spaces", | ||||||||||||||||||||||
| item: WorkItem{ | ||||||||||||||||||||||
| Description: "Improve cache warm-up sequence", | ||||||||||||||||||||||
| TicketIDs: "7003002, 7003003", | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| want: "[7003002,7003003] Improve cache warm-up sequence", | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| name: "no duplicate when description already has same prefix", | ||||||||||||||||||||||
| item: WorkItem{ | ||||||||||||||||||||||
| Description: "[7003004] Add schema validation guard", | ||||||||||||||||||||||
| TicketIDs: "7003004", | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| want: "[7003004] Add schema validation guard", | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
|
||||||||||||||||||||||
| { | |
| { | |
| name: "no duplicate when description has multi-id spaced prefix", | |
| item: WorkItem{ | |
| Description: "[7003002, 7003003] Improve cache warm-up sequence", | |
| TicketIDs: "7003002,7003003", | |
| }, | |
| want: "[7003002, 7003003] Improve cache warm-up sequence", | |
| }, | |
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatItemDescriptionForListtrimsitem.Descriptionand returns the trimmed value even when there are no ticket IDs (or when the prefix is already present). Previously/listrendereditem.Descriptionverbatim, so this subtly changes output formatting and also contradicts the PR note about keeping existing formatting for items without ticket IDs. Consider keeping the original description for the no-ticket / already-prefixed cases (use a trimmed copy only for comparisons), and only trim when you actually need to construct a new prefixed string.