@@ -34,18 +34,14 @@ struct MapsGroundingIntegrationTests {
3434 let candidate = try #require( response. candidates. first)
3535 let groundingMetadata = try #require( candidate. groundingMetadata)
3636
37- #expect( !groundingMetadata. groundingChunks. isEmpty)
37+ let mapChunks = groundingMetadata. groundingChunks. compactMap { $0. maps }
38+ #expect( !mapChunks. isEmpty)
3839
39- var foundMapChunk = false
40- for chunk in groundingMetadata. groundingChunks {
41- if let mapsChunk = chunk. maps {
42- #expect( !mapsChunk. uri. isEmpty)
43- #expect( !mapsChunk. title. isEmpty)
44- #expect( !mapsChunk. placeId. isEmpty)
45- foundMapChunk = true
46- }
40+ for mapsChunk in mapChunks {
41+ #expect( !mapsChunk. uri. isEmpty)
42+ #expect( !mapsChunk. title. isEmpty)
43+ #expect( !mapsChunk. placeId. isEmpty)
4744 }
48- #expect( foundMapChunk)
4945 }
5046
5147 @Test (
@@ -70,17 +66,13 @@ struct MapsGroundingIntegrationTests {
7066 let candidate = try #require( response. candidates. first)
7167 let groundingMetadata = try #require( candidate. groundingMetadata)
7268
73- #expect( !groundingMetadata. groundingChunks. isEmpty)
69+ let mapChunks = groundingMetadata. groundingChunks. compactMap { $0. maps }
70+ #expect( !mapChunks. isEmpty)
7471
75- var foundMapChunk = false
76- for chunk in groundingMetadata. groundingChunks {
77- if let mapsChunk = chunk. maps {
78- #expect( !mapsChunk. uri. isEmpty)
79- #expect( !mapsChunk. title. isEmpty)
80- #expect( !mapsChunk. placeId. isEmpty)
81- foundMapChunk = true
82- }
72+ for mapsChunk in mapChunks {
73+ #expect( !mapsChunk. uri. isEmpty)
74+ #expect( !mapsChunk. title. isEmpty)
75+ #expect( !mapsChunk. placeId. isEmpty)
8376 }
84- #expect( foundMapChunk)
8577 }
8678}
0 commit comments