MCPcopy Index your code
hub / github.com/coder/coder / TestContextWithRunAndStep

Function TestContextWithRunAndStep

coderd/x/chatd/chatdebug/context_test.go:71–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func TestContextWithRunAndStep(t *testing.T) {
72 t.Parallel()
73
74 rc := &chatdebug.RunContext{RunID: uuid.New(), ChatID: uuid.New()}
75 sc := &chatdebug.StepContext{StepID: uuid.New(), RunID: rc.RunID, ChatID: rc.ChatID}
76
77 ctx := chatdebug.ContextWithStep(
78 chatdebug.ContextWithRun(context.Background(), rc),
79 sc,
80 )
81
82 gotRun, ok := chatdebug.RunFromContext(ctx)
83 require.True(t, ok)
84 require.Same(t, rc, gotRun)
85
86 gotStep, ok := chatdebug.StepFromContext(ctx)
87 require.True(t, ok)
88 require.Same(t, sc, gotStep)
89}
90
91func TestContextWithRunPanicsOnNil(t *testing.T) {
92 t.Parallel()

Callers

nothing calls this directly

Calls 5

ContextWithStepFunction · 0.92
ContextWithRunFunction · 0.92
RunFromContextFunction · 0.92
StepFromContextFunction · 0.92
NewMethod · 0.65

Tested by

no test coverage detected