@@ -805,6 +805,10 @@ describe('/api/v1/chat/completions POST endpoint', () => {
805805 } )
806806
807807 describe ( 'Subscription limit enforcement' , ( ) => {
808+ // Bumped from Bun's 5s default: the non-streaming fetch-path tests here
809+ // have flaked right at the boundary (observed 5001ms) on loaded machines.
810+ const SUBSCRIPTION_TEST_TIMEOUT_MS = 15000
811+
808812 const createValidRequest = ( ) =>
809813 new NextRequest ( 'http://localhost:3000/api/v1/chat/completions' , {
810814 method : 'POST' ,
@@ -1050,7 +1054,7 @@ describe('/api/v1/chat/completions POST endpoint', () => {
10501054 expect ( response . status ) . toBe ( 200 )
10511055 // getUserPreferences should not be called for non-subscribers
10521056 expect ( mockGetUserPreferences ) . not . toHaveBeenCalled ( )
1053- } )
1057+ } , SUBSCRIPTION_TEST_TIMEOUT_MS )
10541058
10551059 it . skip ( 'defaults to allowing fallback when getUserPreferences is not provided' , async ( ) => {
10561060 const weeklyLimitError : BlockGrantResult = {
@@ -1077,7 +1081,7 @@ describe('/api/v1/chat/completions POST endpoint', () => {
10771081
10781082 // Should continue processing (default to allowing a-la-carte)
10791083 expect ( response . status ) . toBe ( 200 )
1080- } )
1084+ } , SUBSCRIPTION_TEST_TIMEOUT_MS )
10811085
10821086 it ( 'allows subscriber with 0 a-la-carte credits but active block grant' , async ( ) => {
10831087 const blockGrant : BlockGrantResult = {
0 commit comments