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

Function TestCreate

entities/bug/op_create_test.go:16–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestCreate(t *testing.T) {
17 repo := repository.NewMockRepo()
18
19 rene, err := identity.NewIdentity(repo, "René Descartes", "rene@descartes.fr")
20 require.NoError(t, err)
21
22 b, op, err := Create(rene, time.Now().Unix(), "title", "message", nil, nil)
23 require.NoError(t, err)
24
25 require.Equal(t, "title", op.Title)
26 require.Equal(t, "message", op.Message)
27
28 // Create generate the initial operation and create a new timeline item
29 snap := b.Compile()
30 require.Equal(t, common.OpenStatus, snap.Status)
31 require.Equal(t, rene, snap.Author)
32 require.Equal(t, "title", snap.Title)
33 require.Len(t, snap.Operations, 1)
34 require.Equal(t, op, snap.Operations[0])
35
36 require.Len(t, snap.Timeline, 1)
37 require.Equal(t, entity.CombineIds(b.Id(), op.Id()), snap.Timeline[0].CombinedId())
38 require.Equal(t, rene, snap.Timeline[0].(*CreateTimelineItem).Author)
39 require.Equal(t, "message", snap.Timeline[0].(*CreateTimelineItem).Message)
40}
41
42func TestCreateSerialize(t *testing.T) {
43 dag.SerializeRoundTripTest(t, operationUnmarshaler, func(author identity.Interface, unixTime int64) (*CreateOperation, entity.Resolvers) {

Callers

nothing calls this directly

Calls 8

NewMockRepoFunction · 0.92
NewIdentityFunction · 0.92
CombineIdsFunction · 0.92
CreateFunction · 0.85
CompileMethod · 0.65
IdMethod · 0.65
CombinedIdMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected