From e02294c8f372156945bbc43d70d4d36a07a3fbcf Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Thu, 12 Jul 2018 21:31:41 +0200 Subject: add the first 2 operations --- bug/operations/create_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bug/operations/create_test.go (limited to 'bug/operations/create_test.go') 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() + } +} -- cgit