Fix missing timer cleanup in TTS route tests

Add afterEach to useRealTimers to prevent timer leak between tests
in getCachedAudio describe block
This commit is contained in:
Chris Scott committed 2026-02-03 15:35:11 -05:00
1 parent 8233fec1a9
commit bdd0408346
1 file changed
+8 -4
+8 -4
View File
@@ -1,4 +1,4 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import * as fs from 'fs/promises'
vi.mock('fs/promises', () => ({
@@ -78,9 +78,13 @@ describe('TTS Routes', () => {
})
describe('getCachedAudio', () => {
beforeEach(() => {
vi.useFakeTimers()
})
beforeEach(() => {
vi.useFakeTimers()
})
afterEach(() => {
vi.useRealTimers()
})
it('should return cached audio when file exists and is not expired', async () => {
const cacheKey = 'test-key'