MCPcopy Index your code
hub / github.com/git-bug/git-bug / TestOperationPackReadWrite

Function TestOperationPackReadWrite

entity/dag/operation_pack_test.go:14–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func 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
43func TestOperationPackSignedReadWrite(t *testing.T) {
44 type makerFn func() (repository.ClockedRepo, identity.Interface, identity.Interface, entity.Resolvers, Definition)

Callers

nothing calls this directly

Calls 7

WriteMethod · 0.95
makeTestContextFunction · 0.85
newOp1Function · 0.85
newOp2Function · 0.85
readOperationPackFunction · 0.85
ReadCommitMethod · 0.65
IdMethod · 0.65

Tested by

no test coverage detected