|
14 | 14 |
|
15 | 15 | @testable import App |
16 | 16 |
|
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 | + } |
40 | 43 | } |
41 | 44 |
|
42 | 45 | } |
0 commit comments