aboutsummaryrefslogtreecommitdiffstats
path: root/tests/operation_pack_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/operation_pack_test.go')
-rw-r--r--tests/operation_pack_test.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/operation_pack_test.go b/tests/operation_pack_test.go
index 35b77a8f..62f406a4 100644
--- a/tests/operation_pack_test.go
+++ b/tests/operation_pack_test.go
@@ -1,30 +1,34 @@
package tests
import (
- "github.com/MichaelMure/git-bug/bug"
+ "encoding/json"
+ "reflect"
"testing"
+
+ "github.com/MichaelMure/git-bug/bug"
)
func TestOperationPackSerialize(t *testing.T) {
- opp := bug.OperationPack{}
+ opp := &bug.OperationPack{}
opp.Append(createOp)
opp.Append(setTitleOp)
opp.Append(addCommentOp)
+ opp.Append(setStatusOp)
+ opp.Append(labelChangeOp)
- data, err := opp.Serialize()
-
+ data, err := json.Marshal(opp)
if err != nil {
t.Fatal(err)
}
- if len(data) == 0 {
- t.Fatal("empty serialized data")
- }
-
- _, err = bug.ParseOperationPack(data)
-
+ var opp2 *bug.OperationPack
+ err = json.Unmarshal(data, &opp2)
if err != nil {
t.Fatal(err)
}
+
+ if !reflect.DeepEqual(opp, opp2) {
+ t.Fatalf("%v and %v are different", opp, opp2)
+ }
}