Skip to content

test: add 39 unit tests for estimate-cost helpers - #18

Closed
TerminalGravity wants to merge 1 commit into
mainfrom
pf-eng/estimate-cost-tests
Closed

test: add 39 unit tests for estimate-cost helpers#18
TerminalGravity wants to merge 1 commit into
mainfrom
pf-eng/estimate-cost-tests

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Exports pure helper functions from estimate-cost.ts and adds comprehensive tests:

  • estimateTokens — token estimation from char count
  • extractText — content block text extraction (string, array, null)
  • extractToolNames — tool_use name extraction
  • formatTokens / formatCost / formatDuration — display formatters
  • PRICING — model pricing table validation
  • CORRECTION_SIGNALS — regex accuracy (10 positive, 6 negative cases)

Test suite: 43 → 82 tests. All passing.

Export pure helper functions (estimateTokens, extractText, extractToolNames,
formatTokens, formatCost, formatDuration, PRICING, CORRECTION_SIGNALS) and
add comprehensive unit tests covering edge cases, boundary conditions, and
correction signal regex accuracy.

Test suite: 43 → 82 tests.
@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

Superseded by #25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant