diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-11 22:04:16 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-11 22:14:46 +0200 |
commit | 3605887345792d2f981f971c6c4a2cb7f86a343e (patch) | |
tree | afd525b6e3a638e4c619a5a986fcb2811c297444 /operations/create_test.go | |
parent | 7b05983c19af4da70f2a9a5062913f4e4f5d5faa (diff) | |
download | git-bug-3605887345792d2f981f971c6c4a2cb7f86a343e.tar.gz |
reorganize package for a more idomatic go
Diffstat (limited to 'operations/create_test.go')
-rw-r--r-- | operations/create_test.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/operations/create_test.go b/operations/create_test.go new file mode 100644 index 00000000..a20472d3 --- /dev/null +++ b/operations/create_test.go @@ -0,0 +1,33 @@ +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", nil) + + snapshot = create.Apply(snapshot) + + expected := bug.Snapshot{ + Title: "title", + Comments: []bug.Comment{ + {Author: rene, Message: "message", UnixTime: create.UnixTime}, + }, + Author: rene, + CreatedAt: create.Time(), + } + + if !reflect.DeepEqual(snapshot, expected) { + t.Fatalf("%v different than %v", snapshot, expected) + } +} |