(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestOperationPackReadWrite(t *testing.T) { |
| 15 | repo, author, _, resolver, def := makeTestContext() |
| 16 | |
| 17 | opp := &operationPack{ |
| 18 | Author: author, |
| 19 | Operations: []Operation{ |
| 20 | newOp1(author, "foo"), |
| 21 | newOp2(author, "bar"), |
| 22 | }, |
| 23 | CreateTime: 123, |
| 24 | EditTime: 456, |
| 25 | } |
| 26 | |
| 27 | commitHash, err := opp.Write(def, repo) |
| 28 | require.NoError(t, err) |
| 29 | |
| 30 | commit, err := repo.ReadCommit(commitHash) |
| 31 | require.NoError(t, err) |
| 32 | |
| 33 | opp2, err := readOperationPack(def, repo, resolver, commit) |
| 34 | require.NoError(t, err) |
| 35 | |
| 36 | for _, op := range opp.Operations { |
| 37 | // force the creation of the id |
| 38 | op.Id() |
| 39 | } |
| 40 | require.Equal(t, opp, opp2) |
| 41 | } |
| 42 | |
| 43 | func TestOperationPackSignedReadWrite(t *testing.T) { |
| 44 | type makerFn func() (repository.ClockedRepo, identity.Interface, identity.Interface, entity.Resolvers, Definition) |
nothing calls this directly
no test coverage detected