From fb0c5fd06184f33a03d8d4fb29a3aef8b1dafe78 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 8 Nov 2020 17:54:28 +0100 Subject: repo: expose all lamport clocks, move clocks in their own folder --- bug/operation_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bug/operation_test.go') diff --git a/bug/operation_test.go b/bug/operation_test.go index 20799bb1..91e1d936 100644 --- a/bug/operation_test.go +++ b/bug/operation_test.go @@ -83,7 +83,7 @@ func TestID(t *testing.T) { defer repository.CleanupTestRepos(repo) repos := []repository.ClockedRepo{ - repository.NewMockRepoForTest(), + repository.NewMockRepo(), repo, } -- cgit From 7163b2283b4542a4d4abfe9a71963f122322bde7 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 8 Nov 2020 19:15:06 +0100 Subject: bug: Id from first operation data, not git + remove root link --- bug/operation_test.go | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'bug/operation_test.go') diff --git a/bug/operation_test.go b/bug/operation_test.go index 91e1d936..f66938ad 100644 --- a/bug/operation_test.go +++ b/bug/operation_test.go @@ -11,7 +11,16 @@ import ( ) func TestValidate(t *testing.T) { - rene := identity.NewIdentity("René Descartes", "rene@descartes.fr") + repo := repository.NewMockRepoClock() + + makeIdentity := func(t *testing.T, name, email string) *identity.Identity { + i, err := identity.NewIdentity(repo, name, email) + require.NoError(t, err) + return i + } + + rene := makeIdentity(t, "René Descartes", "rene@descartes.fr") + unix := time.Now().Unix() good := []Operation{ @@ -30,11 +39,11 @@ func TestValidate(t *testing.T) { bad := []Operation{ // opbase - NewSetStatusOp(identity.NewIdentity("", "rene@descartes.fr"), unix, ClosedStatus), - NewSetStatusOp(identity.NewIdentity("René Descartes\u001b", "rene@descartes.fr"), unix, ClosedStatus), - NewSetStatusOp(identity.NewIdentity("René Descartes", "rene@descartes.fr\u001b"), unix, ClosedStatus), - NewSetStatusOp(identity.NewIdentity("René \nDescartes", "rene@descartes.fr"), unix, ClosedStatus), - NewSetStatusOp(identity.NewIdentity("René Descartes", "rene@\ndescartes.fr"), unix, ClosedStatus), + NewSetStatusOp(makeIdentity(t, "", "rene@descartes.fr"), unix, ClosedStatus), + NewSetStatusOp(makeIdentity(t, "René Descartes\u001b", "rene@descartes.fr"), unix, ClosedStatus), + NewSetStatusOp(makeIdentity(t, "René Descartes", "rene@descartes.fr\u001b"), unix, ClosedStatus), + NewSetStatusOp(makeIdentity(t, "René \nDescartes", "rene@descartes.fr"), unix, ClosedStatus), + NewSetStatusOp(makeIdentity(t, "René Descartes", "rene@\ndescartes.fr"), unix, ClosedStatus), &CreateOperation{OpBase: OpBase{ Author: rene, UnixTime: 0, @@ -68,7 +77,11 @@ func TestValidate(t *testing.T) { } func TestMetadata(t *testing.T) { - rene := identity.NewIdentity("René Descartes", "rene@descartes.fr") + repo := repository.NewMockRepoClock() + + rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr") + require.NoError(t, err) + op := NewCreateOp(rene, time.Now().Unix(), "title", "message", nil) op.SetMetadata("key", "value") @@ -88,8 +101,9 @@ func TestID(t *testing.T) { } for _, repo := range repos { - 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) b, op, err := Create(rene, time.Now().Unix(), "title", "message") -- cgit From 3f6ef50883492f77995a7e27872d0b5ae17b9d6a Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 14 Feb 2021 11:36:32 +0100 Subject: bug: migrate to the DAG entity structure! --- bug/operation_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bug/operation_test.go') diff --git a/bug/operation_test.go b/bug/operation_test.go index f66938ad..619f2b43 100644 --- a/bug/operation_test.go +++ b/bug/operation_test.go @@ -45,7 +45,7 @@ func TestValidate(t *testing.T) { NewSetStatusOp(makeIdentity(t, "René \nDescartes", "rene@descartes.fr"), unix, ClosedStatus), NewSetStatusOp(makeIdentity(t, "René Descartes", "rene@\ndescartes.fr"), unix, ClosedStatus), &CreateOperation{OpBase: OpBase{ - Author: rene, + Author_: rene, UnixTime: 0, OperationType: CreateOp, }, @@ -121,7 +121,7 @@ func TestID(t *testing.T) { require.NoError(t, id2.Validate()) require.Equal(t, id1, id2) - b2, err := ReadLocal(repo, b.Id()) + b2, err := Read(repo, b.Id()) require.NoError(t, err) op3 := b2.FirstOp() -- cgit