Skip to content

Commit 958c2f6

Browse files
committed
test: Ecmwf hourly wind speeds of past date
1 parent 60297b0 commit 958c2f6

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.openmeteo.api.ecmwf
2+
3+
import com.openmeteo.api.common.params.IsoDate
4+
import kotlinx.serialization.ExperimentalSerializationApi
5+
import com.openmeteo.api.ecmwf.params.*
6+
import kotlin.test.*
7+
8+
class EcmwfEndpointTest {
9+
10+
companion object {
11+
val endpoint = EcmwfEndpoint()
12+
}
13+
14+
@Test
15+
@ExperimentalSerializationApi
16+
fun `Empty query doesn't throw`() {
17+
endpoint().getOrThrow()
18+
}
19+
20+
@Test
21+
@ExperimentalSerializationApi
22+
fun `Wind speeds of 2022-08-01`() {
23+
val response = endpoint(
24+
hourly = listOf(Hourly.windspeed_10m),
25+
startDate = IsoDate("2022-08-01"),
26+
endDate = IsoDate("2022-08-01"),
27+
).getOrThrow()
28+
val hourly = response.hourly!!
29+
val hourlyWindSpeed = hourly.windspeed_10m!!
30+
assertContentEquals(arrayOf(
31+
14.1f,
32+
10.5f,
33+
14.9f,
34+
15.1f,
35+
11.2f,
36+
14.4f,
37+
9.4f,
38+
6.1f,
39+
), hourlyWindSpeed)
40+
}
41+
}

0 commit comments

Comments
 (0)