@@ -25,7 +25,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
25
25
26
26
// Without `includes` and latest codegenerated types with the model path, the post should be lazy loaded
27
27
func testCommentWithLazyLoadPost( ) async throws {
28
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
28
+ await setup ( withModels: PostComment4V2Models ( ) )
29
29
let post = Post ( title: " title " )
30
30
let comment = Comment ( content: " content " , post: post)
31
31
let createdPost = try await mutate ( . create( post) )
@@ -49,7 +49,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
49
49
50
50
// With `includes` on `comment.post`, the comment's post should be eager loaded.
51
51
func testCommentWithEagerLoadPost( ) async throws {
52
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
52
+ await setup ( withModels: PostComment4V2Models ( ) )
53
53
let post = Post ( title: " title " )
54
54
let comment = Comment ( content: " content " , post: post)
55
55
let createdPost = try await mutate ( . create( post) )
@@ -70,7 +70,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
70
70
71
71
// With `includes` on `comment.post.comments`,
72
72
func testCommentWithEagerLoadPostAndPostComments( ) async throws {
73
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
73
+ await setup ( withModels: PostComment4V2Models ( ) )
74
74
let post = Post ( title: " title " )
75
75
let comment = Comment ( content: " content " , post: post)
76
76
let createdPost = try await mutate ( . create( post) )
@@ -119,7 +119,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
119
119
120
120
// This looks broken
121
121
func testCommentWithEagerLoadPostAndPostCommentsAndPostCommentsPost( ) async throws {
122
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
122
+ await setup ( withModels: PostComment4V2Models ( ) )
123
123
let post = Post ( title: " title " )
124
124
let comment = Comment ( content: " content " , post: post)
125
125
try await mutate ( . create( post) )
@@ -168,7 +168,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
168
168
169
169
// Without `includes` and latest codegenerated types with the model path, the post's comments should be lazy loaded
170
170
func testPostWithLazyLoadComments( ) async throws {
171
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
171
+ await setup ( withModels: PostComment4V2Models ( ) )
172
172
let post = Post ( title: " title " )
173
173
let comment = Comment ( content: " content " , post: post)
174
174
_ = try await mutate ( . create( post) )
@@ -183,7 +183,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
183
183
184
184
// With `includes` on `post.comments` should eager load the post's comments
185
185
func testPostWithEagerLoadComments( ) async throws {
186
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
186
+ await setup ( withModels: PostComment4V2Models ( ) )
187
187
let post = Post ( title: " title " )
188
188
let comment = Comment ( content: " content " , post: post)
189
189
_ = try await mutate ( . create( post) )
@@ -196,7 +196,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
196
196
197
197
// With `includes` on `post.comments.post` should eager load the post's comments' post
198
198
func testPostWithEagerLoadCommentsAndPost( ) async throws {
199
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
199
+ await setup ( withModels: PostComment4V2Models ( ) )
200
200
let post = Post ( title: " title " )
201
201
let comment = Comment ( content: " content " , post: post)
202
202
let createdPost = try await mutate ( . create( post) )
@@ -207,8 +207,26 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
207
207
assertLazyReference ( comments. first!. _post, state: . loaded( model: createdPost) )
208
208
}
209
209
210
+ func testListPostsListComments( ) async throws {
211
+ await setup ( withModels: PostComment4V2Models ( ) )
212
+ let post = Post ( title: " title " )
213
+ let comment = Comment ( content: " content " , post: post)
214
+ try await mutate ( . create( post) )
215
+ try await mutate ( . create( comment) )
216
+
217
+ let queriedPosts = try await listQuery ( . list( Post . self, where: Post . keys. id == post. id) )
218
+ assertList ( queriedPosts, state: . isLoaded( count: 1 ) )
219
+ assertList ( queriedPosts. first!. comments!,
220
+ state: . isNotLoaded( associatedIdentifiers: [ post. id] , associatedField: " post " ) )
221
+
222
+ let queriedComments = try await listQuery ( . list( Comment . self, where: Comment . keys. id == comment. id) )
223
+ assertList ( queriedComments, state: . isLoaded( count: 1 ) )
224
+ assertLazyReference ( queriedComments. first!. _post,
225
+ state: . notLoaded( identifiers: [ . init( name: " id " , value: post. id) ] ) )
226
+ }
227
+
210
228
func testCreateWithoutPost( ) async throws {
211
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
229
+ await setup ( withModels: PostComment4V2Models ( ) )
212
230
let comment = Comment ( content: " content " )
213
231
try await mutate ( . create( comment) )
214
232
var queriedComment = try await query ( . get( Comment . self, byId: comment. id) ) !
@@ -224,7 +242,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
224
242
}
225
243
226
244
func testUpdateToNewPost( ) async throws {
227
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
245
+ await setup ( withModels: PostComment4V2Models ( ) )
228
246
let post = Post ( title: " title " )
229
247
let comment = Comment ( content: " content " , post: post)
230
248
try await mutate ( . create( post) )
@@ -243,7 +261,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
243
261
}
244
262
245
263
func testUpdateRemovePost( ) async throws {
246
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
264
+ await setup ( withModels: PostComment4V2Models ( ) )
247
265
let post = Post ( title: " title " )
248
266
let comment = Comment ( content: " content " , post: post)
249
267
try await mutate ( . create( post) )
@@ -258,7 +276,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
258
276
}
259
277
260
278
func testDelete( ) async throws {
261
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
279
+ await setup ( withModels: PostComment4V2Models ( ) )
262
280
let post = Post ( title: " title " )
263
281
let comment = Comment ( content: " content " , post: post)
264
282
let createdPost = try await mutate ( . create( post) )
@@ -275,7 +293,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
275
293
}
276
294
277
295
func testSubscribeToComments( ) async throws {
278
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
296
+ await setup ( withModels: PostComment4V2Models ( ) )
279
297
let post = Post ( title: " title " )
280
298
try await mutate ( . create( post) )
281
299
let connected = asyncExpectation ( description: " subscription connected " )
@@ -316,7 +334,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
316
334
// The identical `includes` parameter should be used because the selection set of the mutation
317
335
// has to match the selection set of the subscription.
318
336
func testSubscribeToCommentsIncludesPost( ) async throws {
319
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
337
+ await setup ( withModels: PostComment4V2Models ( ) )
320
338
let post = Post ( title: " title " )
321
339
try await mutate ( . create( post) )
322
340
let connected = asyncExpectation ( description: " subscription connected " )
@@ -357,7 +375,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
357
375
}
358
376
359
377
func testSubscribeToPosts( ) async throws {
360
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
378
+ await setup ( withModels: PostComment4V2Models ( ) )
361
379
let post = Post ( title: " title " )
362
380
363
381
let connected = asyncExpectation ( description: " subscription connected " )
@@ -395,7 +413,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest {
395
413
}
396
414
397
415
func testSubscribeToPostsIncludes( ) async throws {
398
- await setup ( withModels: PostComment4V2Models ( ) , logLevel : . verbose )
416
+ await setup ( withModels: PostComment4V2Models ( ) )
399
417
let post = Post ( title: " title " )
400
418
401
419
let connected = asyncExpectation ( description: " subscription connected " )
0 commit comments