Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/utils/__tests__/tiktoken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,10 @@ describe("tiktoken", () => {

const content: Anthropic.Messages.ContentBlockParam[] = [{ type: "text", text: "Hello world" }]

// Time the first call which should create the encoder
const startTime1 = performance.now()
const result1 = await tiktoken(content)
const endTime1 = performance.now()
const duration1 = endTime1 - startTime1

// Time the second call which should reuse the encoder
const startTime2 = performance.now()
const result2 = await tiktoken(content)
const endTime2 = performance.now()
const duration2 = endTime2 - startTime2

// Both calls should return the same token count
expect(result1).toBe(result2)

// This is a loose test and might occasionally fail due to system load,
// but generally the second call should be faster or similar in speed
// since it reuses the encoder
expect(duration2).toBeLessThanOrEqual(duration1 * 1.5)
})
})