aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_create_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-29 20:41:19 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-29 20:41:19 +0200
commitc46d01f8c10e6363b680fa6876e91bd8eaf3bb3e (patch)
treedde41c1253534bf4ff36e39454f2bdbdf4b9590f /bug/op_create_test.go
parent41e61a67b63e4d6c517005cf6f427115a664bdb5 (diff)
downloadgit-bug-c46d01f8c10e6363b680fa6876e91bd8eaf3bb3e.tar.gz
bug: implement comment edition
- add a new operation - add a new "timeline" in the snapshot that hold a processed version of the operations
Diffstat (limited to 'bug/op_create_test.go')
-rw-r--r--bug/op_create_test.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/bug/op_create_test.go b/bug/op_create_test.go
index 2c5ae35b..e9a36cf8 100644
--- a/bug/op_create_test.go
+++ b/bug/op_create_test.go
@@ -1,9 +1,10 @@
package bug
import (
- "reflect"
"testing"
"time"
+
+ "github.com/go-test/deep"
)
func TestCreate(t *testing.T) {
@@ -20,16 +21,27 @@ func TestCreate(t *testing.T) {
create.Apply(&snapshot)
+ hash, err := create.Hash()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ comment := Comment{Author: rene, Message: "message", UnixTime: create.UnixTime}
+
expected := Snapshot{
Title: "title",
Comments: []Comment{
- {Author: rene, Message: "message", UnixTime: create.UnixTime},
+ comment,
},
Author: rene,
CreatedAt: create.Time(),
+ Timeline: []TimelineItem{
+ NewCreateTimelineItem(hash, comment),
+ },
}
- if !reflect.DeepEqual(snapshot, expected) {
- t.Fatalf("%v different than %v", snapshot, expected)
+ deep.CompareUnexportedFields = true
+ if diff := deep.Equal(snapshot, expected); diff != nil {
+ t.Fatal(diff)
}
}