MCPcopy Create free account
hub / github.com/codnect/procyon / TestWithCreationState

Function TestWithCreationState

component/state_test.go:26–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestWithCreationState(t *testing.T) {
27 testCases := []struct {
28 name string
29 parentCtx context.Context
30 }{
31 {
32 name: "nil context",
33 parentCtx: nil,
34 },
35 {
36 name: "any context",
37 parentCtx: context.Background(),
38 },
39 {
40 name: "context with creation state",
41 parentCtx: context.WithValue(context.Background(), ctxCreationStateContextKey, newCreationState()),
42 },
43 }
44
45 for _, tc := range testCases {
46 t.Run(tc.name, func(t *testing.T) {
47 // given
48
49 // when
50 result := withCreationState(tc.parentCtx)
51
52 // then
53 require.NotNil(t, result)
54
55 state := creationStateFromContext(result)
56 assert.NotNil(t, state)
57 })
58 }
59}
60
61func TestCreationStateFromContext(t *testing.T) {
62 // given

Callers

nothing calls this directly

Calls 4

newCreationStateFunction · 0.85
withCreationStateFunction · 0.85
creationStateFromContextFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected