Skip to content

Commit 0db97f3

Browse files
jahoomaclaude
andauthored
Apply 15s timeout to subscription limit tests (#521)
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 711f40c commit 0db97f3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

web/src/app/api/v1/chat/completions/__tests__/completions.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ describe('/api/v1/chat/completions POST endpoint', () => {
833833
expect(body.error).toBe('rate_limit_exceeded')
834834
expect(body.message).toContain('weekly limit reached')
835835
expect(body.message).toContain('Enable "Continue with credits"')
836-
})
836+
}, SUBSCRIPTION_TEST_TIMEOUT_MS)
837837

838838
it('skips subscription limit check when in FREE mode even with fallback disabled', async () => {
839839
const weeklyLimitError: BlockGrantResult = {
@@ -880,7 +880,7 @@ describe('/api/v1/chat/completions POST endpoint', () => {
880880
})
881881

882882
expect(response.status).toBe(200)
883-
})
883+
}, SUBSCRIPTION_TEST_TIMEOUT_MS)
884884

885885
it('returns 429 when block exhausted and fallback disabled', async () => {
886886
const blockExhaustedError: BlockGrantResult = {
@@ -914,7 +914,7 @@ describe('/api/v1/chat/completions POST endpoint', () => {
914914
expect(body.error).toBe('rate_limit_exceeded')
915915
expect(body.message).toContain('5-hour session limit reached')
916916
expect(body.message).toContain('Enable "Continue with credits"')
917-
})
917+
}, SUBSCRIPTION_TEST_TIMEOUT_MS)
918918

919919
it('continues when weekly limit reached but fallback is enabled', async () => {
920920
const weeklyLimitError: BlockGrantResult = {
@@ -945,7 +945,7 @@ describe('/api/v1/chat/completions POST endpoint', () => {
945945

946946
expect(response.status).toBe(200)
947947
expect(mockLogger.info).toHaveBeenCalled()
948-
})
948+
}, SUBSCRIPTION_TEST_TIMEOUT_MS)
949949

950950
it('continues when block grant is created successfully', async () => {
951951
const blockGrant: BlockGrantResult = {
@@ -977,7 +977,7 @@ describe('/api/v1/chat/completions POST endpoint', () => {
977977
expect(response.status).toBe(200)
978978
// getUserPreferences should not be called when block grant succeeds
979979
expect(mockGetUserPreferences).not.toHaveBeenCalled()
980-
})
980+
}, SUBSCRIPTION_TEST_TIMEOUT_MS)
981981

982982
it.skip('continues when ensureSubscriberBlockGrant throws an error (fail open)', async () => {
983983
const mockEnsureSubscriberBlockGrant = mock(async () => {

0 commit comments

Comments
 (0)