@@ -21,6 +21,9 @@ import com.amplifyframework.geo.GeoException
21
21
import com.amplifyframework.geo.models.Coordinates
22
22
import com.amplifyframework.geo.models.MapStyle
23
23
import com.amplifyframework.geo.models.MapStyleDescriptor
24
+ import com.amplifyframework.geo.options.GeoSearchByCoordinatesOptions
25
+ import com.amplifyframework.geo.options.GeoSearchByTextOptions
26
+ import com.amplifyframework.geo.options.GetMapStyleDescriptorOptions
24
27
import com.amplifyframework.geo.result.GeoSearchResult
25
28
import io.mockk.every
26
29
import io.mockk.mockk
@@ -91,6 +94,18 @@ internal class KotlinGeoFacadeTest {
91
94
assertSame(descriptor, result)
92
95
}
93
96
97
+ @Test
98
+ fun `returns map style descriptor with options` () = runBlocking {
99
+ val descriptor = MapStyleDescriptor (" " )
100
+ val options = GetMapStyleDescriptorOptions .builder().mapName(" map" ).build()
101
+ every { delegate.getMapStyleDescriptor(options, any(), any()) } answers {
102
+ val callback = secondArg<Consumer <MapStyleDescriptor >>()
103
+ callback.accept(descriptor)
104
+ }
105
+ val result = geo.getMapStyleDescriptor(options)
106
+ assertSame(descriptor, result)
107
+ }
108
+
94
109
@Test(expected = GeoException ::class )
95
110
fun `throws map style descriptor error` (): Unit = runBlocking {
96
111
val error = GeoException (" message" , " suggestion" )
@@ -113,6 +128,19 @@ internal class KotlinGeoFacadeTest {
113
128
assertSame(searchResult, result)
114
129
}
115
130
131
+ @Test
132
+ fun `returns search by text result with options` () = runBlocking {
133
+ val query = " query"
134
+ val options = GeoSearchByTextOptions .builder().maxResults(4 ).build()
135
+ val searchResult = GeoSearchResult .withPlaces(emptyList())
136
+ every { delegate.searchByText(query, options, any(), any()) } answers {
137
+ val callback = thirdArg<Consumer <GeoSearchResult >>()
138
+ callback.accept(searchResult)
139
+ }
140
+ val result = geo.searchByText(query, options)
141
+ assertSame(searchResult, result)
142
+ }
143
+
116
144
@Test(expected = GeoException ::class )
117
145
fun `throws search by text error` (): Unit = runBlocking {
118
146
val query = " query"
@@ -136,6 +164,19 @@ internal class KotlinGeoFacadeTest {
136
164
assertSame(searchResult, result)
137
165
}
138
166
167
+ @Test
168
+ fun `returns search by coordinates result with options` () = runBlocking {
169
+ val position = Coordinates ()
170
+ val options = GeoSearchByCoordinatesOptions .builder().maxResults(3 ).build()
171
+ val searchResult = GeoSearchResult .withPlaces(emptyList())
172
+ every { delegate.searchByCoordinates(position, options, any(), any()) } answers {
173
+ val callback = thirdArg<Consumer <GeoSearchResult >>()
174
+ callback.accept(searchResult)
175
+ }
176
+ val result = geo.searchByCoordinates(position, options)
177
+ assertSame(searchResult, result)
178
+ }
179
+
139
180
@Test(expected = GeoException ::class )
140
181
fun `throws search by coordinates error` (): Unit = runBlocking {
141
182
val position = Coordinates ()
0 commit comments