Skip to content

Commit 2850483

Browse files
committed
tests(weather): create weather unit tests
1 parent a15c18f commit 2850483

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// RequestsClientWeatherTests.swift
3+
// PodiumRequestsClient
4+
//
5+
// Created by Mathis Le Bonniec on 12/21/25.
6+
//
7+
8+
import PodiumRequestsClient
9+
import Testing
10+
11+
@Suite(.tags(.weather))
12+
struct RequestsClientWeatherTests {
13+
let sessionKey: Int = 9094
14+
let client: RequestsClient = RequestsClient(
15+
baseURL: "https://api.podium.mathislebonniec.fr/v1/formula1",
16+
apiKey: "08fe5ccd-8d72-49e0-ae2b-3f097f2b96a1"
17+
)
18+
19+
@Test
20+
func getAllWeather() async throws {
21+
let weatherUpdates = try await client.getAllWeatherUpdates(sessionKey: sessionKey)
22+
23+
#expect(weatherUpdates.count == 176)
24+
}
25+
26+
@Test
27+
func getOneWeather() async throws {
28+
let weatherUpdates = try await client.getAllWeatherUpdates(sessionKey: sessionKey)
29+
let first = try #require(weatherUpdates.first(where: { $0.pressure == 1013.7 }))
30+
31+
#expect(first.humidity == 39)
32+
#expect(first.pressure == 1013.7)
33+
#expect(first.temperature.track == 47.4)
34+
#expect(first.temperature.air == 25.8)
35+
#expect(first.wind.direction == 149)
36+
#expect(first.wind.speed == 1)
37+
}
38+
}

0 commit comments

Comments
 (0)