Skip to content

Commit

Permalink
mr discussion: Update tests
Browse files Browse the repository at this point in the history
Update the tests after the previous changes.

Cleanup: mr_note_test.go:Test_mrNoteText() is the same test
as note_common_test.go:Test_noteText().

Signed-off-by: Prarit Bhargava <[email protected]>
  • Loading branch information
prarit committed Aug 25, 2021
1 parent ad90d0e commit 653549a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
9 changes: 5 additions & 4 deletions cmd/mr_discussion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func Test_mrDiscussionMsg(t *testing.T) {
t.Run(test.Name, func(t *testing.T) {
test := test
t.Parallel()
body, err := mrDiscussionMsg(test.Msgs)
body, err := mrDiscussionMsg(1, "OPEN", "", test.Msgs, "")
if err != nil {
t.Fatal(err)
}
Expand All @@ -78,12 +78,13 @@ func Test_mrDiscussionMsg(t *testing.T) {

func Test_mrDiscussionText(t *testing.T) {
t.Parallel()
text, err := mrDiscussionText()
tmpl := mrDiscussionGetTemplate("")
text, err := noteText(1701, "OPEN", "", "\n", tmpl)
if err != nil {
t.Fatal(err)
}
require.Equal(t, `
# Write a message for this discussion. Commented lines are discarded.`, text)

# This thread is being started on OPEN Merge Request 1701.
# Comment lines beginning with '#' are discarded.`, text)
}
14 changes: 1 addition & 13 deletions cmd/mr_note_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,11 @@ func Test_mrNoteMsg(t *testing.T) {
t.Run(test.Name, func(t *testing.T) {
test := test
t.Parallel()
body, err := noteMsg(test.Msgs, true, "\n")
body, err := noteMsg(test.Msgs, true, 1, "OPEN", "", "\n")
if err != nil {
t.Fatal(err)
}
assert.Equal(t, test.ExpectedBody, body)
})
}
}

func Test_mrNoteText(t *testing.T) {
t.Parallel()
text, err := noteText("\n")
if err != nil {
t.Fatal(err)
}
require.Equal(t, `
# Write a message for this note. Commented lines are discarded.`, text)

}
9 changes: 5 additions & 4 deletions cmd/note_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Test_noteMsg(t *testing.T) {
t.Run(test.Name, func(t *testing.T) {
test := test
t.Parallel()
body, err := noteMsg(test.Msgs, false, "\n")
body, err := noteMsg(test.Msgs, false, 1, "OPEN", "", "\n")
if err != nil {
t.Fatal(err)
}
Expand All @@ -42,12 +42,13 @@ func Test_noteMsg(t *testing.T) {

func Test_noteText(t *testing.T) {
t.Parallel()
text, err := noteText("\n")
tmpl := noteGetTemplate(true, "")
text, err := noteText(1701, "OPEN", "", "\n", tmpl)
if err != nil {
t.Fatal(err)
}
require.Equal(t, `
# Write a message for this note. Commented lines are discarded.`, text)

# This comment is being applied to OPEN Merge Request 1701.
# Comment lines beginning with '#' are discarded.`, text)
}

0 comments on commit 653549a

Please sign in to comment.