Skip to content

Commit 8c123e1

Browse files
committed
Convert GitTests
1 parent 872b86e commit 8c123e1

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

Tests/AppTests/GitTests.swift

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import Foundation
16+
1517
@testable import App
1618

1719
import Dependencies
1820
import ShellOut
19-
import XCTVapor
20-
21+
import Testing
2122

22-
class GitTests: XCTestCase {
2323

24+
@Suite struct GitTests {
2425

25-
func test_tag() async throws {
26+
@Test func tag() async throws {
2627
try await withDependencies {
2728
$0.shell.run = mock(for: "git tag", """
2829
test
@@ -33,17 +34,17 @@ class GitTests: XCTestCase {
3334
"""
3435
)
3536
} operation: {
36-
try await XCTAssertEqualAsync(
37-
try await Git.getTags(at: "ignored"), [
38-
.tag(.init(1, 0, 0, "pre")),
39-
.tag(.init(1, 0, 0)),
40-
.tag(.init(1, 0, 1)),
41-
.tag(.init(1, 0, 2)),
42-
])
37+
let tags = try await Git.getTags(at: "ignored")
38+
#expect(tags == [
39+
.tag(.init(1, 0, 0, "pre")),
40+
.tag(.init(1, 0, 0)),
41+
.tag(.init(1, 0, 1)),
42+
.tag(.init(1, 0, 2)),
43+
])
4344
}
4445
}
4546

46-
func test_revInfo() async throws {
47+
@Test func revInfo() async throws {
4748
try await withDependencies {
4849
$0.shell.run = { @Sendable cmd, _ in
4950
if cmd.description == #"git log -n1 --format=tformat:"%H-%ct" 2.2.1"# {
@@ -52,13 +53,14 @@ class GitTests: XCTestCase {
5253
throw TestError.unknownCommand
5354
}
5455
} operation: {
55-
try await XCTAssertEqualAsync(try await Git.revisionInfo(.tag(.init(2, 2, 1)), at: "ignored"),
56-
.init(commit: "63c973f3c2e632a340936c285e94d59f9ffb01d5",
57-
date: Date(timeIntervalSince1970: 1536799579)))
56+
let revisionInfo = try await Git.revisionInfo(.tag(2, 2, 1), at: "ignored")
57+
#expect(revisionInfo ==
58+
.init(commit: "63c973f3c2e632a340936c285e94d59f9ffb01d5",
59+
date: Date(timeIntervalSince1970: 1536799579)))
5860
}
5961
}
6062

61-
func test_revInfo_tagName() async throws {
63+
@Test func revInfo_tagName() async throws {
6264
// Ensure we look up by tag name and not semver
6365
// https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/139
6466
try await withDependencies {
@@ -69,9 +71,10 @@ class GitTests: XCTestCase {
6971
throw TestError.unknownCommand
7072
}
7173
} operation: {
72-
try await XCTAssertEqualAsync(try await Git.revisionInfo(.tag(.init(2, 2, 1), "v2.2.1"), at: "ignored"),
73-
.init(commit: "63c973f3c2e632a340936c285e94d59f9ffb01d5",
74-
date: Date(timeIntervalSince1970: 1536799579)))
74+
let revisionInfo = try await Git.revisionInfo(.tag(.init(2, 2, 1), "v2.2.1"), at: "ignored")
75+
#expect(revisionInfo ==
76+
.init(commit: "63c973f3c2e632a340936c285e94d59f9ffb01d5",
77+
date: Date(timeIntervalSince1970: 1536799579)))
7578
}
7679
}
7780

0 commit comments

Comments
 (0)