Skip to content

Commit 8e3984c

Browse files
committed
test(chat): make RateLimiter mock a constructable class
The arrow-function mockImplementation form was not reliably constructable in the full suite run (`new RateLimiter()` threw "is not a constructor"), though it passed in isolation. Switch to the class-based mock used by the sibling OTP/speech route tests.
1 parent 9b246ba commit 8e3984c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/sim/app/api/chat/utils.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ const {
3131
}))
3232

3333
vi.mock('@/lib/core/rate-limiter', () => ({
34-
RateLimiter: vi.fn().mockImplementation(() => ({
35-
checkRateLimitDirect: mockCheckRateLimitDirect,
36-
})),
34+
RateLimiter: class {
35+
checkRateLimitDirect = mockCheckRateLimitDirect
36+
},
3737
}))
3838

3939
vi.mock('@/lib/auth', () => ({

0 commit comments

Comments
 (0)