Fix pointer dereferencing in Update RPC handler (#223)
- Dereference Design, AcceptanceCriteria, Notes, and Assignee pointers in updatesFromArgs - Fixes EOF errors when using --notes, --design, --assignee, or --acceptance-criteria flags - Enhance TestUpdateIssue to verify all pointer-dereferenced fields are correctly stored
This commit is contained in:
@@ -213,9 +213,18 @@ func TestUpdateIssue(t *testing.T) {
|
||||
json.Unmarshal(createResp.Data, &issue)
|
||||
|
||||
newTitle := "Updated Title"
|
||||
notes := "Some important notes"
|
||||
design := "Design details"
|
||||
assignee := "alice"
|
||||
acceptance := "Acceptance criteria"
|
||||
|
||||
updateArgs := &UpdateArgs{
|
||||
ID: issue.ID,
|
||||
Title: &newTitle,
|
||||
ID: issue.ID,
|
||||
Title: &newTitle,
|
||||
Notes: ¬es,
|
||||
Design: &design,
|
||||
Assignee: &assignee,
|
||||
AcceptanceCriteria: &acceptance,
|
||||
}
|
||||
|
||||
updateResp, err := client.Update(updateArgs)
|
||||
@@ -229,6 +238,18 @@ func TestUpdateIssue(t *testing.T) {
|
||||
if updatedIssue.Title != newTitle {
|
||||
t.Errorf("Expected title %s, got %s", newTitle, updatedIssue.Title)
|
||||
}
|
||||
if updatedIssue.Notes != notes {
|
||||
t.Errorf("Expected notes %s, got %s", notes, updatedIssue.Notes)
|
||||
}
|
||||
if updatedIssue.Design != design {
|
||||
t.Errorf("Expected design %s, got %s", design, updatedIssue.Design)
|
||||
}
|
||||
if updatedIssue.Assignee != assignee {
|
||||
t.Errorf("Expected assignee %s, got %s", assignee, updatedIssue.Assignee)
|
||||
}
|
||||
if updatedIssue.AcceptanceCriteria != acceptance {
|
||||
t.Errorf("Expected acceptance criteria %s, got %s", acceptance, updatedIssue.AcceptanceCriteria)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloseIssue(t *testing.T) {
|
||||
|
||||
@@ -50,16 +50,16 @@ func updatesFromArgs(a UpdateArgs) map[string]interface{} {
|
||||
u["priority"] = *a.Priority
|
||||
}
|
||||
if a.Design != nil {
|
||||
u["design"] = a.Design
|
||||
u["design"] = *a.Design
|
||||
}
|
||||
if a.AcceptanceCriteria != nil {
|
||||
u["acceptance_criteria"] = a.AcceptanceCriteria
|
||||
u["acceptance_criteria"] = *a.AcceptanceCriteria
|
||||
}
|
||||
if a.Notes != nil {
|
||||
u["notes"] = a.Notes
|
||||
u["notes"] = *a.Notes
|
||||
}
|
||||
if a.Assignee != nil {
|
||||
u["assignee"] = a.Assignee
|
||||
u["assignee"] = *a.Assignee
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user