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

Function TestChatCostSummary_AfterModelDeletion

coderd/exp_chats_test.go:10210–10230  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10208}
10209
10210func TestChatCostSummary_AfterModelDeletion(t *testing.T) {
10211 t.Parallel()
10212
10213 f := seedChatCostFixture(t)
10214 ctx := testutil.Context(t, testutil.WaitLong)
10215 options := f.safeOptions()
10216
10217 // Baseline: use DB-derived timestamps to avoid time boundary flakes.
10218 summary, err := f.Client.GetChatCostSummary(ctx, "me", options)
10219 require.NoError(t, err)
10220 assertChatCostSummary(t, summary, f.ModelConfigID, f.ChatID)
10221
10222 // Soft-delete the model config.
10223 err = f.Client.DeleteChatModelConfig(ctx, f.ModelConfigID)
10224 require.NoError(t, err)
10225
10226 // Costs must survive the deletion unchanged within the same safe window.
10227 summary, err = f.Client.GetChatCostSummary(ctx, "me", options)
10228 require.NoError(t, err)
10229 assertChatCostSummary(t, summary, f.ModelConfigID, f.ChatID)
10230}
10231
10232func TestChatCostSummary_AdminDrilldown(t *testing.T) {
10233 t.Parallel()

Callers

nothing calls this directly

Calls 6

ContextFunction · 0.92
seedChatCostFixtureFunction · 0.85
assertChatCostSummaryFunction · 0.85
safeOptionsMethod · 0.80
DeleteChatModelConfigMethod · 0.80
GetChatCostSummaryMethod · 0.65

Tested by

no test coverage detected