diff options
author | Michael Muré <batolettre@gmail.com> | 2023-08-12 14:05:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-12 14:05:02 +0200 |
commit | 20e62977a0509e2c79ef5d8d9173103a278b78ff (patch) | |
tree | 9a39ab11d0373caeaf34f2d06188c481d27f67d7 /entity/dag/operation_pack_test.go | |
parent | a0d225ce23af9f5dbe31521f19485c66d409e573 (diff) | |
parent | 429b913dc5519babfab47bf65222e32415a6c1bd (diff) | |
download | git-bug-20e62977a0509e2c79ef5d8d9173103a278b78ff.tar.gz |
Merge pull request #1088 from MichaelMure/dependabot/go_modules/github.com/99designs/gqlgen-0.17.36
build(deps): bump github.com/99designs/gqlgen from 0.17.20 to 0.17.36
Diffstat (limited to 'entity/dag/operation_pack_test.go')
-rw-r--r-- | entity/dag/operation_pack_test.go | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/entity/dag/operation_pack_test.go b/entity/dag/operation_pack_test.go index bd8e8e03..09e60caf 100644 --- a/entity/dag/operation_pack_test.go +++ b/entity/dag/operation_pack_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/require" "github.com/MichaelMure/git-bug/entities/identity" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/repository" ) @@ -40,37 +41,46 @@ func TestOperationPackReadWrite(t *testing.T) { } func TestOperationPackSignedReadWrite(t *testing.T) { - repo, author, _, resolver, def := makeTestContext() - - err := author.(*identity.Identity).Mutate(repo, func(orig *identity.Mutator) { - orig.Keys = append(orig.Keys, identity.GenerateKey()) - }) - require.NoError(t, err) + type makerFn func() (repository.ClockedRepo, identity.Interface, identity.Interface, entity.Resolvers, Definition) - opp := &operationPack{ - Author: author, - Operations: []Operation{ - newOp1(author, "foo"), - newOp2(author, "bar"), + for _, maker := range []makerFn{ + makeTestContext, + func() (repository.ClockedRepo, identity.Interface, identity.Interface, entity.Resolvers, Definition) { + return makeTestContextGoGit(t) }, - CreateTime: 123, - EditTime: 456, - } - - commitHash, err := opp.Write(def, repo) - require.NoError(t, err) - - commit, err := repo.ReadCommit(commitHash) - require.NoError(t, err) - - opp2, err := readOperationPack(def, repo, resolver, commit) - require.NoError(t, err) - - for _, op := range opp.Operations { - // force the creation of the id - op.Id() + } { + repo, author, _, resolver, def := maker() + + err := author.(*identity.Identity).Mutate(repo, func(orig *identity.Mutator) { + orig.Keys = append(orig.Keys, identity.GenerateKey()) + }) + require.NoError(t, err) + + opp := &operationPack{ + Author: author, + Operations: []Operation{ + newOp1(author, "foo"), + newOp2(author, "bar"), + }, + CreateTime: 123, + EditTime: 456, + } + + commitHash, err := opp.Write(def, repo) + require.NoError(t, err) + + commit, err := repo.ReadCommit(commitHash) + require.NoError(t, err) + + opp2, err := readOperationPack(def, repo, resolver, commit) + require.NoError(t, err) + + for _, op := range opp.Operations { + // force the creation of the id + op.Id() + } + require.Equal(t, opp, opp2) } - require.Equal(t, opp, opp2) } func TestOperationPackFiles(t *testing.T) { |