1package operations
2
3import (
4 "github.com/MichaelMure/git-bug/bug"
5 "reflect"
6 "testing"
7)
8
9func TestCreate(t *testing.T) {
10 snapshot := bug.Snapshot{}
11
12 var rene = bug.Person{
13 Name: "René Descartes",
14 Email: "rene@descartes.fr",
15 }
16
17 create := NewCreateOp(rene, "title", "message")
18
19 snapshot = create.Apply(snapshot)
20
21 expected := bug.Snapshot{
22 Title: "title",
23 Comments: []bug.Comment{
24 {Author: rene, Message: "message", Time: create.Time},
25 },
26 }
27
28 if !reflect.DeepEqual(snapshot, expected) {
29 t.Fatalf("%s different than %s", snapshot, expected)
30 }
31}