diff options
Diffstat (limited to 'tests/operation_pack_test.go')
-rw-r--r-- | tests/operation_pack_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/operation_pack_test.go b/tests/operation_pack_test.go index 62f406a4..d7393c29 100644 --- a/tests/operation_pack_test.go +++ b/tests/operation_pack_test.go @@ -6,6 +6,8 @@ import ( "testing" "github.com/MichaelMure/git-bug/bug" + "github.com/MichaelMure/git-bug/operations" + "github.com/MichaelMure/git-bug/util/git" ) func TestOperationPackSerialize(t *testing.T) { @@ -17,6 +19,24 @@ func TestOperationPackSerialize(t *testing.T) { opp.Append(setStatusOp) opp.Append(labelChangeOp) + opMeta := operations.NewCreateOp(rene, "title", "message", nil) + opMeta.SetMetadata("key", "value") + opp.Append(opMeta) + + if len(opMeta.Metadata) != 1 { + t.Fatal() + } + + opFile := operations.NewCreateOp(rene, "title", "message", []git.Hash{ + "abcdef", + "ghijkl", + }) + opp.Append(opFile) + + if len(opFile.Files) != 2 { + t.Fatal() + } + data, err := json.Marshal(opp) if err != nil { t.Fatal(err) |