Remove flaky tiktoken test (#3113)

This commit is contained in:
Matt Rubens 2025-05-02 00:40:44 -04:00 committed by GitHub
parent 6a6443e648
commit f813ed850b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
})
})