test: add count tokens endpoint test suite

Add comprehensive test suite for /v1/messages/count_tokens endpoint:
- Simple text messages
- Multi-turn conversations
- System prompts (string and array format)
- Tool definitions and tool use/result blocks
- Thinking blocks
- Content arrays with text blocks
- Error handling for invalid requests
- Long text tokenization

Also adds npm script test:counttokens for running tests individually.
This commit is contained in:
minhphuc429
2026-01-14 15:36:11 +07:00
parent acc228b920
commit 53da774bb6
3 changed files with 455 additions and 2 deletions

View File

@@ -18,7 +18,8 @@ const tests = [
{ name: 'Cross-Model Thinking', file: 'test-cross-model-thinking.cjs' },
{ name: 'OAuth No-Browser Mode', file: 'test-oauth-no-browser.cjs' },
{ name: 'Empty Response Retry', file: 'test-empty-response-retry.cjs' },
{ name: 'Schema Sanitizer', file: 'test-schema-sanitizer.cjs' }
{ name: 'Schema Sanitizer', file: 'test-schema-sanitizer.cjs' },
{ name: 'Count Tokens', file: 'test-count-tokens.cjs' }
];
async function runTest(test) {