|
12 | 12 | // See the License for the specific language governing permissions and |
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | | -import XCTest |
| 15 | +import Testing |
| 16 | +import Foundation |
16 | 17 | @testable import BreezeLambdaAPIClient |
17 | 18 |
|
18 | | -final class APIEndpointTests: XCTestCase { |
| 19 | +@Suite |
| 20 | +struct APIEndpointTests { |
19 | 21 |
|
20 | | - var environment: APIClientEnv! |
21 | | - var sut: APIEndpoint! |
| 22 | + let environment: APIClientEnv |
22 | 23 | let baseURL: String = "https://apitest123.execute-api.us-east-1.amazonaws.com" |
23 | 24 |
|
24 | | - override func setUpWithError() throws { |
| 25 | + init() throws { |
25 | 26 | let session = URLSession(configuration: .ephemeral) |
26 | 27 | environment = try APIClientEnv(session: session, baseURL: baseURL) |
27 | 28 | } |
28 | 29 |
|
29 | | - override func tearDownWithError() throws { |
30 | | - environment = nil |
| 30 | + @Test |
| 31 | + func initSetPath() throws { |
| 32 | + let sut = APIEndpoint(env: environment, path: "path", queryItems: [URLQueryItem(name: "name", value: "value")]) |
| 33 | + #expect(sut.path == "path") |
31 | 34 | } |
32 | 35 |
|
33 | | - func testInit() throws { |
34 | | - sut = APIEndpoint(env: environment, path: "path", queryItems: [URLQueryItem(name: "name", value: "value")]) |
35 | | - XCTAssertEqual(sut.path, "path") |
36 | | - } |
37 | | - |
38 | | - func testUrl_whenNoPathAndNoQueryItemes() throws { |
39 | | - sut = APIEndpoint(env: environment, path: "", queryItems: nil) |
| 36 | + @Test |
| 37 | + func url_whenNoPathAndNoQueryItemes() throws { |
| 38 | + let sut = APIEndpoint(env: environment, path: "", queryItems: nil) |
40 | 39 | let url = try sut.url() |
41 | | - XCTAssertEqual(url.absoluteString, "https://apitest123.execute-api.us-east-1.amazonaws.com") |
| 40 | + #expect(url.absoluteString == "https://apitest123.execute-api.us-east-1.amazonaws.com") |
42 | 41 | } |
43 | 42 |
|
44 | | - func testUrl_whenNoQueryItemes() throws { |
45 | | - sut = APIEndpoint(env: environment, path: "path", queryItems: nil) |
| 43 | + @Test |
| 44 | + func url_whenNoQueryItemes() throws { |
| 45 | + let sut = APIEndpoint(env: environment, path: "path", queryItems: nil) |
46 | 46 | let url = try sut.url() |
47 | | - XCTAssertEqual(url.absoluteString, "https://apitest123.execute-api.us-east-1.amazonaws.com/path") |
| 47 | + #expect(url.absoluteString == "https://apitest123.execute-api.us-east-1.amazonaws.com/path") |
48 | 48 | } |
49 | 49 |
|
50 | | - func testUrl_whenNoPathAndQueryItemes() throws { |
51 | | - sut = APIEndpoint(env: environment, path: "", queryItems: [URLQueryItem(name: "name", value: "value")]) |
| 50 | + @Test |
| 51 | + func url_whenNoPathAndQueryItemes() throws { |
| 52 | + let sut = APIEndpoint(env: environment, path: "", queryItems: [URLQueryItem(name: "name", value: "value")]) |
52 | 53 | let url = try sut.url() |
53 | | - XCTAssertEqual(url.absoluteString, "https://apitest123.execute-api.us-east-1.amazonaws.com?name=value") |
| 54 | + #expect(url.absoluteString == "https://apitest123.execute-api.us-east-1.amazonaws.com?name=value") |
54 | 55 | } |
55 | 56 |
|
56 | | - func testUrl_whenQueryItemes() throws { |
57 | | - sut = APIEndpoint(env: environment, path: "path", queryItems: [URLQueryItem(name: "name", value: "value")]) |
| 57 | + @Test |
| 58 | + func url_whenQueryItemes() throws { |
| 59 | + let sut = APIEndpoint(env: environment, path: "path", queryItems: [URLQueryItem(name: "name", value: "value")]) |
58 | 60 | let url = try sut.url() |
59 | | - XCTAssertEqual(url.absoluteString, "https://apitest123.execute-api.us-east-1.amazonaws.com/path?name=value") |
| 61 | + #expect(url.absoluteString == "https://apitest123.execute-api.us-east-1.amazonaws.com/path?name=value") |
60 | 62 | } |
61 | 63 | } |
0 commit comments