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

Function TestID

entities/bug/operation_test.go:94–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestID(t *testing.T) {
95 repo := repository.CreateGoGitTestRepo(t, false)
96
97 repos := []repository.ClockedRepo{
98 repository.NewMockRepo(),
99 repo,
100 }
101
102 for _, repo := range repos {
103 rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr")
104 require.NoError(t, err)
105 err = rene.Commit(repo)
106 require.NoError(t, err)
107
108 b, op, err := Create(rene, time.Now().Unix(), "title", "message", nil, nil)
109 require.NoError(t, err)
110
111 id1 := op.Id()
112 require.NoError(t, id1.Validate())
113
114 err = b.Commit(repo)
115 require.NoError(t, err)
116
117 op2 := b.FirstOp()
118
119 id2 := op2.Id()
120 require.NoError(t, id2.Validate())
121 require.Equal(t, id1, id2)
122
123 b2, err := Read(repo, b.Id())
124 require.NoError(t, err)
125
126 op3 := b2.FirstOp()
127
128 id3 := op3.Id()
129 require.NoError(t, id3.Validate())
130 require.Equal(t, id1, id3)
131 }
132}

Callers

nothing calls this directly

Calls 10

CommitMethod · 0.95
CreateGoGitTestRepoFunction · 0.92
NewMockRepoFunction · 0.92
NewIdentityFunction · 0.92
CreateFunction · 0.85
ReadFunction · 0.70
IdMethod · 0.65
ValidateMethod · 0.65
CommitMethod · 0.65
FirstOpMethod · 0.65

Tested by

no test coverage detected