aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operations/create_test.go
blob: bd73fc1a64b2a0919760f7ce479700022c4ebbc4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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", Time: create.Time},
		},
	}

	if !reflect.DeepEqual(snapshot, expected) {
		t.Fatalf("%s different than %s", snapshot, expected)
	}
}