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)
| 13 | // nil/unpriced branches are exercised by TestComputeMessageCost in |
| 14 | // after_llm_call_test.go, which shares the same computeMessageCost source. |
| 15 | func 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 | } |
nothing calls this directly
no test coverage detected