MCPcopy Create free account
hub / github.com/github/gh-aw / TestExtractUsageRecord

Function TestExtractUsageRecord

pkg/cli/token_usage_test.go:252–263  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

250}
251
252func TestExtractUsageRecord(t *testing.T) {
253 t.Run("returns nested usage record", func(t *testing.T) {
254 record := extractUsageRecord(map[string]any{"ai_credits": 1.5})
255 require.NotNil(t, record)
256 assert.InDelta(t, 1.5, record["ai_credits"].(float64), 1e-9)
257 })
258
259 t.Run("returns nil for non-map input", func(t *testing.T) {
260 assert.Nil(t, extractUsageRecord("not-a-map"))
261 assert.Nil(t, extractUsageRecord(nil))
262 })
263}
264
265func TestIsFinite(t *testing.T) {
266 assert.True(t, isFinite(1.25))

Callers

nothing calls this directly

Calls 2

extractUsageRecordFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected