aboutsummaryrefslogtreecommitdiffstats
path: root/bug/bug_test.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-11-08 19:15:06 +0100
committerMichael Muré <batolettre@gmail.com>2021-02-14 12:17:44 +0100
commit7163b2283b4542a4d4abfe9a71963f122322bde7 (patch)
tree93a52a65c5ba1fd3e4112b2aa53c2c438bb5400c /bug/bug_test.go
parent5ae8a132772385c903a62de2ceec02a97f108a01 (diff)
downloadgit-bug-7163b2283b4542a4d4abfe9a71963f122322bde7.tar.gz
bug: Id from first operation data, not git + remove root link
Diffstat (limited to 'bug/bug_test.go')
-rw-r--r--bug/bug_test.go28
1 files changed, 16 insertions, 12 deletions
diff --git a/bug/bug_test.go b/bug/bug_test.go
index 047fe386..a8987ac1 100644
--- a/bug/bug_test.go
+++ b/bug/bug_test.go
@@ -12,19 +12,20 @@ import (
)
func TestBugId(t *testing.T) {
- mockRepo := repository.NewMockRepo()
+ repo := repository.NewMockRepo()
bug1 := NewBug()
- rene := identity.NewIdentity("René Descartes", "rene@descartes.fr")
- err := rene.Commit(mockRepo)
+ rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr")
+ require.NoError(t, err)
+ err = rene.Commit(repo)
require.NoError(t, err)
createOp := NewCreateOp(rene, time.Now().Unix(), "title", "message", nil)
bug1.Append(createOp)
- err = bug1.Commit(mockRepo)
+ err = bug1.Commit(repo)
if err != nil {
t.Fatal(err)
@@ -34,12 +35,13 @@ func TestBugId(t *testing.T) {
}
func TestBugValidity(t *testing.T) {
- mockRepo := repository.NewMockRepo()
+ repo := repository.NewMockRepo()
bug1 := NewBug()
- rene := identity.NewIdentity("René Descartes", "rene@descartes.fr")
- err := rene.Commit(mockRepo)
+ rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr")
+ require.NoError(t, err)
+ err = rene.Commit(repo)
require.NoError(t, err)
createOp := NewCreateOp(rene, time.Now().Unix(), "title", "message", nil)
@@ -54,7 +56,7 @@ func TestBugValidity(t *testing.T) {
t.Fatal("Bug with just a CreateOp should be valid")
}
- err = bug1.Commit(mockRepo)
+ err = bug1.Commit(repo)
if err != nil {
t.Fatal(err)
}
@@ -65,7 +67,7 @@ func TestBugValidity(t *testing.T) {
t.Fatal("Bug with multiple CreateOp should be invalid")
}
- err = bug1.Commit(mockRepo)
+ err = bug1.Commit(repo)
if err == nil {
t.Fatal("Invalid bug should not commit")
}
@@ -76,8 +78,9 @@ func TestBugCommitLoad(t *testing.T) {
bug1 := NewBug()
- rene := identity.NewIdentity("René Descartes", "rene@descartes.fr")
- err := rene.Commit(repo)
+ rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr")
+ require.NoError(t, err)
+ err = rene.Commit(repo)
require.NoError(t, err)
createOp := NewCreateOp(rene, time.Now().Unix(), "title", "message", nil)
@@ -137,7 +140,8 @@ func TestBugRemove(t *testing.T) {
require.NoError(t, err)
// generate a bunch of bugs
- rene := identity.NewIdentity("René Descartes", "rene@descartes.fr")
+ rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr")
+ require.NoError(t, err)
err = rene.Commit(repo)
require.NoError(t, err)