mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-16 11:00:42 +03:00
32 lines
569 B
Go
32 lines
569 B
Go
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("%v different than %v", snapshot, expected)
|
|
}
|
|
}
|