aboutsummaryrefslogtreecommitdiffstats
path: root/entity/dag/op_noop_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-08-24 21:40:30 +0200
committerGitHub <noreply@github.com>2022-08-24 21:40:30 +0200
commit5c91174a84592b027c1b432a72ebf2974ec0e4c5 (patch)
tree1306f7f617968e13e6f28eda51417ae8cd2c6c6a /entity/dag/op_noop_test.go
parentccb71fea57bb17f267f135cb008470615595c5b7 (diff)
parente1b172aaf0e984791b5af4a64b144339fd4042f6 (diff)
downloadgit-bug-5c91174a84592b027c1b432a72ebf2974ec0e4c5.tar.gz
Merge pull request #861 from MichaelMure/test-with-unmarshaler
dag: test op serialisation with the unmarshaller, to allow resolving entities
Diffstat (limited to 'entity/dag/op_noop_test.go')
-rw-r--r--entity/dag/op_noop_test.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/entity/dag/op_noop_test.go b/entity/dag/op_noop_test.go
index c7710b83..61497b5b 100644
--- a/entity/dag/op_noop_test.go
+++ b/entity/dag/op_noop_test.go
@@ -1,13 +1,19 @@
package dag
import (
+ "encoding/json"
"testing"
"github.com/MichaelMure/git-bug/entities/identity"
+ "github.com/MichaelMure/git-bug/entity"
)
func TestNoopSerialize(t *testing.T) {
- SerializeRoundTripTest(t, func(author identity.Interface, unixTime int64) *NoOpOperation[*snapshotMock] {
- return NewNoOpOp[*snapshotMock](1, author, unixTime)
+ SerializeRoundTripTest(t, func(raw json.RawMessage, resolver entity.Resolvers) (Operation, error) {
+ var op NoOpOperation[*snapshotMock]
+ err := json.Unmarshal(raw, &op)
+ return &op, err
+ }, func(author identity.Interface, unixTime int64) (*NoOpOperation[*snapshotMock], entity.Resolvers) {
+ return NewNoOpOp[*snapshotMock](1, author, unixTime), nil
})
}