aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_edit_comment_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-11-30 00:41:50 +0100
committerMichael Muré <batolettre@gmail.com>2021-02-14 12:17:49 +0100
commitfcf43915e1736fe0b56f8f06386f68d9b56da7a8 (patch)
treee85beec4672a8a4792317323ac33a2df8ad40f98 /bug/op_edit_comment_test.go
parentd96284da646cc1d3e3d7d3b2f7a1ab0e8e7a4d88 (diff)
downloadgit-bug-fcf43915e1736fe0b56f8f06386f68d9b56da7a8.tar.gz
bug: fix tests
Diffstat (limited to 'bug/op_edit_comment_test.go')
-rw-r--r--bug/op_edit_comment_test.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/bug/op_edit_comment_test.go b/bug/op_edit_comment_test.go
index 92ee7539..a7330932 100644
--- a/bug/op_edit_comment_test.go
+++ b/bug/op_edit_comment_test.go
@@ -43,35 +43,35 @@ func TestEdit(t *testing.T) {
id3 := comment2.Id()
require.NoError(t, id3.Validate())
- edit := NewEditCommentOp(rene, unix, id1, "create edited", nil)
+ edit := NewEditCommentOp(rene, unix, snapshot.Comments[0].Id(), "create edited", nil)
edit.Apply(&snapshot)
- require.Equal(t, len(snapshot.Timeline), 4)
- require.Equal(t, len(snapshot.Timeline[0].(*CreateTimelineItem).History), 2)
- require.Equal(t, len(snapshot.Timeline[1].(*AddCommentTimelineItem).History), 1)
- require.Equal(t, len(snapshot.Timeline[3].(*AddCommentTimelineItem).History), 1)
+ require.Len(t, snapshot.Timeline, 4)
+ require.Len(t, snapshot.Timeline[0].(*CreateTimelineItem).History, 2)
+ require.Len(t, snapshot.Timeline[1].(*AddCommentTimelineItem).History, 1)
+ require.Len(t, snapshot.Timeline[3].(*AddCommentTimelineItem).History, 1)
require.Equal(t, snapshot.Comments[0].Message, "create edited")
require.Equal(t, snapshot.Comments[1].Message, "comment 1")
require.Equal(t, snapshot.Comments[2].Message, "comment 2")
- edit2 := NewEditCommentOp(rene, unix, id2, "comment 1 edited", nil)
+ edit2 := NewEditCommentOp(rene, unix, snapshot.Comments[1].Id(), "comment 1 edited", nil)
edit2.Apply(&snapshot)
- require.Equal(t, len(snapshot.Timeline), 4)
- require.Equal(t, len(snapshot.Timeline[0].(*CreateTimelineItem).History), 2)
- require.Equal(t, len(snapshot.Timeline[1].(*AddCommentTimelineItem).History), 2)
- require.Equal(t, len(snapshot.Timeline[3].(*AddCommentTimelineItem).History), 1)
+ require.Len(t, snapshot.Timeline, 4)
+ require.Len(t, snapshot.Timeline[0].(*CreateTimelineItem).History, 2)
+ require.Len(t, snapshot.Timeline[1].(*AddCommentTimelineItem).History, 2)
+ require.Len(t, snapshot.Timeline[3].(*AddCommentTimelineItem).History, 1)
require.Equal(t, snapshot.Comments[0].Message, "create edited")
require.Equal(t, snapshot.Comments[1].Message, "comment 1 edited")
require.Equal(t, snapshot.Comments[2].Message, "comment 2")
- edit3 := NewEditCommentOp(rene, unix, id3, "comment 2 edited", nil)
+ edit3 := NewEditCommentOp(rene, unix, snapshot.Comments[2].Id(), "comment 2 edited", nil)
edit3.Apply(&snapshot)
- require.Equal(t, len(snapshot.Timeline), 4)
- require.Equal(t, len(snapshot.Timeline[0].(*CreateTimelineItem).History), 2)
- require.Equal(t, len(snapshot.Timeline[1].(*AddCommentTimelineItem).History), 2)
- require.Equal(t, len(snapshot.Timeline[3].(*AddCommentTimelineItem).History), 2)
+ require.Len(t, snapshot.Timeline, 4)
+ require.Len(t, snapshot.Timeline[0].(*CreateTimelineItem).History, 2)
+ require.Len(t, snapshot.Timeline[1].(*AddCommentTimelineItem).History, 2)
+ require.Len(t, snapshot.Timeline[3].(*AddCommentTimelineItem).History, 2)
require.Equal(t, snapshot.Comments[0].Message, "create edited")
require.Equal(t, snapshot.Comments[1].Message, "comment 1 edited")
require.Equal(t, snapshot.Comments[2].Message, "comment 2 edited")