aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_edit_comment_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_edit_comment_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_edit_comment_test.go')
-rw-r--r--bug/op_edit_comment_test.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/bug/op_edit_comment_test.go b/bug/op_edit_comment_test.go
index ab0f2d21..9e8739da 100644
--- a/bug/op_edit_comment_test.go
+++ b/bug/op_edit_comment_test.go
@@ -20,14 +20,14 @@ func TestEdit(t *testing.T) {
create := NewCreateOp(rene, unix, "title", "create", nil)
create.Apply(&snapshot)
- hash1, err := create.Hash()
- require.NoError(t, err)
+ hash1 := create.ID()
+ require.True(t, IDIsValid(hash1))
comment1 := NewAddCommentOp(rene, unix, "comment 1", nil)
comment1.Apply(&snapshot)
- hash2, err := comment1.Hash()
- require.NoError(t, err)
+ hash2 := comment1.ID()
+ require.True(t, IDIsValid(hash2))
// add another unrelated op in between
setTitle := NewSetTitleOp(rene, unix, "edited title", "title")
@@ -36,8 +36,8 @@ func TestEdit(t *testing.T) {
comment2 := NewAddCommentOp(rene, unix, "comment 2", nil)
comment2.Apply(&snapshot)
- hash3, err := comment2.Hash()
- require.NoError(t, err)
+ hash3 := comment2.ID()
+ require.True(t, IDIsValid(hash3))
edit := NewEditCommentOp(rene, unix, hash1, "create edited", nil)
edit.Apply(&snapshot)
@@ -85,5 +85,8 @@ func TestEditCommentSerialize(t *testing.T) {
err = json.Unmarshal(data, &after)
assert.NoError(t, err)
+ // enforce creating the ID
+ before.ID()
+
assert.Equal(t, before, &after)
}