aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operations/create_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-12 21:31:41 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-12 21:32:11 +0200
commite02294c8f372156945bbc43d70d4d36a07a3fbcf (patch)
treeec928f35309280db8ec6f03640b9b6b2ac3caad6 /bug/operations/create_test.go
parent3aecdf2c2da9017513ca04a183089099fb3677d5 (diff)
downloadgit-bug-e02294c8f372156945bbc43d70d4d36a07a3fbcf.tar.gz
add the first 2 operations
Diffstat (limited to 'bug/operations/create_test.go')
-rw-r--r--bug/operations/create_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/bug/operations/create_test.go b/bug/operations/create_test.go
new file mode 100644
index 00000000..35e515ac
--- /dev/null
+++ b/bug/operations/create_test.go
@@ -0,0 +1,31 @@
+package operations
+
+import (
+ "github.com/MichaelMure/git-bug/bug"
+ "reflect"
+ "testing"
+)
+
+func TestCreate(t *testing.T) {
+ snapshot := bug.Snapshot{}
+
+ var rene = bug.Person{
+ Name: "René Descartes",
+ Email: "rene@descartes.fr",
+ }
+
+ create := NewCreateOp(rene, "title", "message")
+
+ snapshot = create.Apply(snapshot)
+
+ expected := bug.Snapshot{
+ Title: "title",
+ Comments: []bug.Comment{
+ {Author: rene, Message: "message"},
+ },
+ }
+
+ if !reflect.DeepEqual(snapshot, expected) {
+ t.Fail()
+ }
+}