|
14 | 14 |
|
15 | 15 | @testable import App |
16 | 16 |
|
| 17 | +import Testing |
17 | 18 | import Vapor |
18 | | -import XCTest |
19 | 19 |
|
20 | 20 |
|
21 | | -class PackageController_BuildsRoute_BuildInfoTests: AppTestCase { |
| 21 | +@Suite struct PackageController_BuildsRoute_BuildInfoTests { |
22 | 22 |
|
23 | | - func test_buildStatus() throws { |
| 23 | + @Test func buildStatus() throws { |
24 | 24 | // Test build status aggregation, in particular see |
25 | 25 | // https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/666 |
26 | 26 | // setup |
27 | 27 | // MUT & verification |
28 | | - XCTAssertEqual([mkBuildInfo(.ok), mkBuildInfo(.failed)].compatibility, .compatible) |
29 | | - XCTAssertEqual([mkBuildInfo(.triggered), mkBuildInfo(.triggered)].compatibility, .unknown) |
30 | | - XCTAssertEqual([mkBuildInfo(.failed), mkBuildInfo(.triggered)].compatibility, .unknown) |
31 | | - XCTAssertEqual([mkBuildInfo(.ok), mkBuildInfo(.triggered)].compatibility, .compatible) |
| 28 | + #expect([mkBuildInfo(.ok), mkBuildInfo(.failed)].compatibility == .compatible) |
| 29 | + #expect([mkBuildInfo(.triggered), mkBuildInfo(.triggered)].compatibility == .unknown) |
| 30 | + #expect([mkBuildInfo(.failed), mkBuildInfo(.triggered)].compatibility == .unknown) |
| 31 | + #expect([mkBuildInfo(.ok), mkBuildInfo(.triggered)].compatibility == .compatible) |
32 | 32 | } |
33 | 33 |
|
34 | | - func test_noneSucceeded() throws { |
35 | | - XCTAssertTrue([mkBuildInfo(.failed), mkBuildInfo(.failed)].noneSucceeded) |
36 | | - XCTAssertFalse([mkBuildInfo(.ok), mkBuildInfo(.failed)].noneSucceeded) |
| 34 | + @Test func noneSucceeded() throws { |
| 35 | + #expect([mkBuildInfo(.failed), mkBuildInfo(.failed)].noneSucceeded) |
| 36 | + #expect(![mkBuildInfo(.ok), mkBuildInfo(.failed)].noneSucceeded) |
37 | 37 | } |
38 | 38 |
|
39 | | - func test_anySucceeded() throws { |
40 | | - XCTAssertTrue([mkBuildInfo(.ok), mkBuildInfo(.failed)].anySucceeded) |
41 | | - XCTAssertFalse([mkBuildInfo(.failed), mkBuildInfo(.failed)].anySucceeded) |
| 39 | + @Test func anySucceeded() throws { |
| 40 | + #expect([mkBuildInfo(.ok), mkBuildInfo(.failed)].anySucceeded) |
| 41 | + #expect(![mkBuildInfo(.failed), mkBuildInfo(.failed)].anySucceeded) |
42 | 42 | } |
43 | 43 |
|
44 | | - func test_nonePending() throws { |
45 | | - XCTAssertTrue([mkBuildInfo(.ok), mkBuildInfo(.failed)].nonePending) |
46 | | - XCTAssertFalse([mkBuildInfo(.ok), mkBuildInfo(.triggered)].nonePending) |
| 44 | + @Test func nonePending() throws { |
| 45 | + #expect([mkBuildInfo(.ok), mkBuildInfo(.failed)].nonePending) |
| 46 | + #expect(![mkBuildInfo(.ok), mkBuildInfo(.triggered)].nonePending) |
47 | 47 | // timeouts will not be retried - therefore they are not pending |
48 | | - XCTAssertTrue([mkBuildInfo(.ok), mkBuildInfo(.timeout)].nonePending) |
| 48 | + #expect([mkBuildInfo(.ok), mkBuildInfo(.timeout)].nonePending) |
49 | 49 | // infrastructure errors _will_ be retried - they are pending |
50 | | - XCTAssertFalse([mkBuildInfo(.ok), mkBuildInfo(.infrastructureError)].nonePending) |
| 50 | + #expect(![mkBuildInfo(.ok), mkBuildInfo(.infrastructureError)].nonePending) |
51 | 51 | } |
52 | 52 |
|
53 | | - func test_anyPending() throws { |
54 | | - XCTAssertFalse([mkBuildInfo(.ok), mkBuildInfo(.failed)].anyPending) |
55 | | - XCTAssertTrue([mkBuildInfo(.ok), mkBuildInfo(.triggered)].anyPending) |
| 53 | + @Test func anyPending() throws { |
| 54 | + #expect(![mkBuildInfo(.ok), mkBuildInfo(.failed)].anyPending) |
| 55 | + #expect([mkBuildInfo(.ok), mkBuildInfo(.triggered)].anyPending) |
56 | 56 | // timeouts will not be retried - therefore they are not pending |
57 | | - XCTAssertTrue([mkBuildInfo(.ok), mkBuildInfo(.timeout)].nonePending) |
| 57 | + #expect([mkBuildInfo(.ok), mkBuildInfo(.timeout)].nonePending) |
58 | 58 | // infrastructure errors _will_ be retried - they are pending |
59 | | - XCTAssertFalse([mkBuildInfo(.ok), mkBuildInfo(.infrastructureError)].nonePending) |
| 59 | + #expect(![mkBuildInfo(.ok), mkBuildInfo(.infrastructureError)].nonePending) |
60 | 60 | } |
61 | 61 |
|
62 | | - func test_Platform_isCompatible() throws { |
63 | | - XCTAssertTrue(Build.Platform.iOS.isCompatible(with: .iOS)) |
64 | | - XCTAssertFalse(Build.Platform.iOS.isCompatible(with: .macOS)) |
| 62 | + @Test func Platform_isCompatible() throws { |
| 63 | + #expect(Build.Platform.iOS.isCompatible(with: .iOS)) |
| 64 | + #expect(!Build.Platform.iOS.isCompatible(with: .macOS)) |
65 | 65 |
|
66 | | - XCTAssertTrue(Build.Platform.macosSpm.isCompatible(with: .macOS)) |
67 | | - XCTAssertTrue(Build.Platform.macosXcodebuild.isCompatible(with: .macOS)) |
| 66 | + #expect(Build.Platform.macosSpm.isCompatible(with: .macOS)) |
| 67 | + #expect(Build.Platform.macosXcodebuild.isCompatible(with: .macOS)) |
68 | 68 | } |
69 | 69 |
|
70 | 70 | } |
|
0 commit comments