@@ -73,34 +73,38 @@ export function createJoinsTestSuite(getConfig: () => Promise<E2ETestConfig>) {
7373 await query . cleanup ( )
7474 } )
7575
76- it ( `should join with one eager, one on-demand` , async ( ) => {
77- const config = await getConfig ( )
78- const usersEager = config . collections . eager . users
79- const postsOnDemand = config . collections . onDemand . posts
80-
81- const query = createLiveQueryCollection ( ( q ) =>
82- q
83- . from ( { user : usersEager } )
84- . join ( { post : postsOnDemand } , ( { user, post } ) =>
85- eq ( user . id , post . userId )
86- )
87- . select ( ( { user, post } ) => ( {
88- id : post ! . id ,
89- userName : user . name ,
90- postTitle : post ! . title ,
91- } ) )
92- )
93-
94- await query . preload ( )
95- // Joins with eager + on-demand collections may need more time to load data from multiple sources
96- // Use longer timeout for CI environments which can be slower
97- await waitForQueryData ( query , { minSize : 1 , timeout : 30000 } )
98-
99- const results = Array . from ( query . state . values ( ) )
100- expect ( results . length ) . toBeGreaterThan ( 0 )
101-
102- await query . cleanup ( )
103- } )
76+ it (
77+ `should join with one eager, one on-demand` ,
78+ { timeout : 60000 } ,
79+ async ( ) => {
80+ const config = await getConfig ( )
81+ const usersEager = config . collections . eager . users
82+ const postsOnDemand = config . collections . onDemand . posts
83+
84+ const query = createLiveQueryCollection ( ( q ) =>
85+ q
86+ . from ( { user : usersEager } )
87+ . join ( { post : postsOnDemand } , ( { user, post } ) =>
88+ eq ( user . id , post . userId )
89+ )
90+ . select ( ( { user, post } ) => ( {
91+ id : post ! . id ,
92+ userName : user . name ,
93+ postTitle : post ! . title ,
94+ } ) )
95+ )
96+
97+ await query . preload ( )
98+ // Joins with eager + on-demand collections may need more time to load data from multiple sources
99+ // Use longer timeout for CI environments which can be slower
100+ await waitForQueryData ( query , { minSize : 1 , timeout : 30000 } )
101+
102+ const results = Array . from ( query . state . values ( ) )
103+ expect ( results . length ) . toBeGreaterThan ( 0 )
104+
105+ await query . cleanup ( )
106+ }
107+ )
104108
105109 it ( `should join with ordering across collections` , async ( ) => {
106110 const config = await getConfig ( )
@@ -243,39 +247,43 @@ export function createJoinsTestSuite(getConfig: () => Promise<E2ETestConfig>) {
243247 await query . cleanup ( )
244248 } )
245249
246- it ( `should handle mixed syncModes in 3-way join` , async ( ) => {
247- const config = await getConfig ( )
248- const usersEager = config . collections . eager . users
249- const postsOnDemand = config . collections . onDemand . posts
250- const commentsOnDemand = config . collections . onDemand . comments
251-
252- const query = createLiveQueryCollection ( ( q ) =>
253- q
254- . from ( { user : usersEager } )
255- . join ( { post : postsOnDemand } , ( { user, post } ) =>
256- eq ( user . id , post . userId )
257- )
258- . join ( { comment : commentsOnDemand } , ( { post, comment } ) =>
259- eq ( post ! . id , comment . postId )
260- )
261- . select ( ( { user, post, comment } ) => ( {
262- id : comment ! . id ,
263- userName : user . name ,
264- postTitle : post ! . title ,
265- commentText : comment ! . text ,
266- } ) )
267- )
268-
269- await query . preload ( )
270- // 3-way joins with mixed eager + on-demand collections need more time
271- // Use longer timeout for CI environments which can be slower
272- await waitForQueryData ( query , { minSize : 1 , timeout : 30000 } )
273-
274- const results = Array . from ( query . state . values ( ) )
275- expect ( results . length ) . toBeGreaterThan ( 0 )
276-
277- await query . cleanup ( )
278- } )
250+ it (
251+ `should handle mixed syncModes in 3-way join` ,
252+ { timeout : 60000 } ,
253+ async ( ) => {
254+ const config = await getConfig ( )
255+ const usersEager = config . collections . eager . users
256+ const postsOnDemand = config . collections . onDemand . posts
257+ const commentsOnDemand = config . collections . onDemand . comments
258+
259+ const query = createLiveQueryCollection ( ( q ) =>
260+ q
261+ . from ( { user : usersEager } )
262+ . join ( { post : postsOnDemand } , ( { user, post } ) =>
263+ eq ( user . id , post . userId )
264+ )
265+ . join ( { comment : commentsOnDemand } , ( { post, comment } ) =>
266+ eq ( post ! . id , comment . postId )
267+ )
268+ . select ( ( { user, post, comment } ) => ( {
269+ id : comment ! . id ,
270+ userName : user . name ,
271+ postTitle : post ! . title ,
272+ commentText : comment ! . text ,
273+ } ) )
274+ )
275+
276+ await query . preload ( )
277+ // 3-way joins with mixed eager + on-demand collections need more time
278+ // Use longer timeout for CI environments which can be slower
279+ await waitForQueryData ( query , { minSize : 1 , timeout : 30000 } )
280+
281+ const results = Array . from ( query . state . values ( ) )
282+ expect ( results . length ) . toBeGreaterThan ( 0 )
283+
284+ await query . cleanup ( )
285+ }
286+ )
279287 } )
280288
281289 describe ( `Predicate Pushdown in Joins` , ( ) => {
0 commit comments