From 2a5b6e1423d8dc598eda38f31b213158691c8439 Mon Sep 17 00:00:00 2001 From: inputvalidation <26655367+inputvalidation@users.noreply.github.com> Date: Sat, 13 Jan 2024 10:50:00 +0100 Subject: [PATCH] Reorder TestReorderIssue() function --- issues_test.go | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/issues_test.go b/issues_test.go index 501614cb6..0b73499a4 100644 --- a/issues_test.go +++ b/issues_test.go @@ -92,6 +92,35 @@ func TestDeleteIssue(t *testing.T) { } } +func TestReorderIssue(t *testing.T) { + mux, client := setup(t) + + mux.HandleFunc("/api/v4/projects/1/issues/5/reorder", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, http.MethodPut) + fmt.Fprint(w, `{"id":1, "title" : "Reordered issue", "description": "This is the description of a reordered issue", "author" : {"id" : 1, "name": "corrie"}, "assignees":[{"id":1}]}`) + }) + + afterID := 100 + opt := ReorderIssueOptions{MoveAfterID: &afterID} + + issue, _, err := client.Issues.ReorderIssue("1", 5, &opt) + if err != nil { + log.Fatal(err) + } + + want := &Issue{ + ID: 1, + Title: "Reordered issue", + Description: "This is the description of a reordered issue", + Author: &IssueAuthor{ID: 1, Name: "corrie"}, + Assignees: []*IssueAssignee{{ID: 1}}, + } + + if !reflect.DeepEqual(want, issue) { + t.Errorf("Issues.ReorderIssue returned %+v, want %+v", issue, want) + } +} + func TestMoveIssue(t *testing.T) { mux, client := setup(t) @@ -931,32 +960,3 @@ func TestGetIssueGroupMilestone(t *testing.T) { t.Errorf("Issues.GetIssue returned %+v, want %+v", issue, want) } } - -func TestReorderIssue(t *testing.T) { - mux, client := setup(t) - - mux.HandleFunc("/api/v4/projects/1/issues/5/reorder", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, http.MethodPut) - fmt.Fprint(w, `{"id":1, "title" : "Reordered issue", "description": "This is the description of a reordered issue", "author" : {"id" : 1, "name": "corrie"}, "assignees":[{"id":1}]}`) - }) - - afterID := 100 - opt := ReorderIssueOptions{MoveAfterID: &afterID} - - issue, _, err := client.Issues.ReorderIssue("1", 5, &opt) - if err != nil { - log.Fatal(err) - } - - want := &Issue{ - ID: 1, - Title: "Reordered issue", - Description: "This is the description of a reordered issue", - Author: &IssueAuthor{ID: 1, Name: "corrie"}, - Assignees: []*IssueAssignee{{ID: 1}}, - } - - if !reflect.DeepEqual(want, issue) { - t.Errorf("Issues.ReorderIssue returned %+v, want %+v", issue, want) - } -}