mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
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:
1 parent
8233fec1a9
commit
bdd0408346
1 file changed
+8
-4
@@ -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'
|
||||
|
||||
Reference in new issue
Block a user