aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_create_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-08-07 15:31:38 +0200
committerMichael Muré <batolettre@gmail.com>2019-08-08 19:02:46 +0200
commit2e1a5e246ee3589c2f664a62ebd06be7dc69c229 (patch)
tree03e69d6991fb4b9f9a159ba2d7b74b5f36d5069d /bug/op_create_test.go
parent2c3034a0abe13eb6b07d8dd13041e7be4adc6f93 (diff)
downloadgit-bug-2e1a5e246ee3589c2f664a62ebd06be7dc69c229.tar.gz
bug: compute op's ID based on the serialized data on disk
Diffstat (limited to 'bug/op_create_test.go')
-rw-r--r--bug/op_create_test.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/bug/op_create_test.go b/bug/op_create_test.go
index 2a88f256..20c8ec69 100644
--- a/bug/op_create_test.go
+++ b/bug/op_create_test.go
@@ -20,11 +20,11 @@ func TestCreate(t *testing.T) {
create.Apply(&snapshot)
- hash, err := create.Hash()
- assert.NoError(t, err)
+ id := create.ID()
+ assert.True(t, IDIsValid(id))
comment := Comment{
- id: string(hash),
+ id: string(id),
Author: rene,
Message: "message",
UnixTime: timestamp.Timestamp(create.UnixTime),
@@ -41,7 +41,7 @@ func TestCreate(t *testing.T) {
CreatedAt: create.Time(),
Timeline: []TimelineItem{
&CreateTimelineItem{
- CommentTimelineItem: NewCommentTimelineItem(hash, comment),
+ CommentTimelineItem: NewCommentTimelineItem(id, comment),
},
},
}
@@ -61,5 +61,8 @@ func TestCreateSerialize(t *testing.T) {
err = json.Unmarshal(data, &after)
assert.NoError(t, err)
+ // enforce creating the ID
+ before.ID()
+
assert.Equal(t, before, &after)
}