MCPcopy Index your code
hub / github.com/docker/docker-agent / TestUsageHasTokens

Function TestUsageHasTokens

pkg/runtime/cost_test.go:15–23  ·  view source on GitHub ↗

TestUsageHasTokens covers the helper that suppresses the missing-price warning for empty/no-op turns. The per-message cost arithmetic and its nil/unpriced branches are exercised by TestComputeMessageCost in after_llm_call_test.go, which shares the same computeMessageCost source.

(t *testing.T)

Source from the content-addressed store, hash-verified

13// nil/unpriced branches are exercised by TestComputeMessageCost in
14// after_llm_call_test.go, which shares the same computeMessageCost source.
15func TestUsageHasTokens(t *testing.T) {
16 t.Parallel()
17 assert.False(t, usageHasTokens(nil), "nil usage has no tokens")
18 assert.False(t, usageHasTokens(&chat.Usage{}), "zero usage has no tokens")
19 assert.True(t, usageHasTokens(&chat.Usage{InputTokens: 1}))
20 assert.True(t, usageHasTokens(&chat.Usage{OutputTokens: 1}))
21 assert.True(t, usageHasTokens(&chat.Usage{CachedInputTokens: 1}))
22 assert.True(t, usageHasTokens(&chat.Usage{CacheWriteTokens: 1}))
23}

Callers

nothing calls this directly

Calls 1

usageHasTokensFunction · 0.85

Tested by

no test coverage detected