Skip to content

Commit a27b19d

Browse files
committed
Convert BuildResultTests
1 parent 39e820c commit a27b19d

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

Tests/AppTests/BuildResultTests.swift

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,32 @@
1414

1515
@testable import App
1616

17-
import XCTVapor
18-
19-
20-
class BuildResultTests: AppTestCase {
21-
22-
func test_query() async throws {
23-
// setup
24-
let pkg = try await savePackage(on: app.db, "1".url)
25-
let repo = try Repository(package: pkg)
26-
try await repo.save(on: app.db)
27-
let version = try Version(package: pkg)
28-
try await version.save(on: app.db)
29-
let build = try Build(version: version, platform: .iOS, status: .ok, swiftVersion: .init(5, 3, 0))
30-
try await build.save(on: app.db)
31-
32-
// MUT
33-
let res = try await BuildResult.query(on: app.db, buildId: build.id!)
34-
35-
// validate
36-
XCTAssertEqual(res.build.id, build.id)
37-
XCTAssertEqual(res.package.id, pkg.id)
38-
XCTAssertEqual(res.repository.id, repo.id)
39-
XCTAssertEqual(res.version.id, version.id)
17+
import Testing
18+
import Vapor
19+
20+
21+
@Suite struct BuildResultTests {
22+
23+
@Test func query() async throws {
24+
try await withApp { app in
25+
// setup
26+
let pkg = try await savePackage(on: app.db, "1".url)
27+
let repo = try Repository(package: pkg)
28+
try await repo.save(on: app.db)
29+
let version = try Version(package: pkg)
30+
try await version.save(on: app.db)
31+
let build = try Build(version: version, platform: .iOS, status: .ok, swiftVersion: .init(5, 3, 0))
32+
try await build.save(on: app.db)
33+
34+
// MUT
35+
let res = try await BuildResult.query(on: app.db, buildId: build.id!)
36+
37+
// validate
38+
#expect(res.build.id == build.id)
39+
#expect(res.package.id == pkg.id)
40+
#expect(res.repository.id == repo.id)
41+
#expect(res.version.id == version.id)
42+
}
4043
}
4144

4245
}

0 commit comments

Comments
 (0)