Skip to content

Commit 7228a54

Browse files
committed
Convert LicenseTests
1 parent f61f6f0 commit 7228a54

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

Tests/AppTests/LicenseTests.swift

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,42 @@
1414

1515
@testable import App
1616

17-
import XCTVapor
17+
import Testing
1818

19-
class LicenseTests: XCTestCase {
2019

21-
func test_init_from_dto() throws {
22-
XCTAssertEqual(License(from: Github.Metadata.LicenseInfo(key: "mit")), .mit)
23-
XCTAssertEqual(License(from: Github.Metadata.LicenseInfo(key: "agpl-3.0")), .agpl_3_0)
24-
XCTAssertEqual(License(from: Github.Metadata.LicenseInfo(key: "other")), .other)
25-
XCTAssertEqual(License(from: .none), .none)
20+
@Suite struct LicenseTests {
21+
22+
@Test func init_from_dto() throws {
23+
#expect(License(from: Github.Metadata.LicenseInfo(key: "mit")) == .mit)
24+
#expect(License(from: Github.Metadata.LicenseInfo(key: "agpl-3.0")) == .agpl_3_0)
25+
#expect(License(from: Github.Metadata.LicenseInfo(key: "other")) == .other)
26+
#expect(License(from: .none) == .none)
2627
}
2728

28-
func test_init_from_dto_unknown() throws {
29+
@Test func init_from_dto_unknown() throws {
2930
// ensure unknown licenses are mapped to `.other`
30-
XCTAssertEqual(License(from: Github.Metadata.LicenseInfo(key: "non-existing license")), .other)
31+
#expect(License(from: Github.Metadata.LicenseInfo(key: "non-existing license")) == .other)
3132
}
3233

33-
func test_fullName() throws {
34-
XCTAssertEqual(License.mit.fullName, "MIT License")
35-
XCTAssertEqual(License.agpl_3_0.fullName, "GNU Affero General Public License v3.0")
36-
XCTAssertEqual(License.other.fullName, "Unknown or Unrecognised License")
37-
XCTAssertEqual(License.none.fullName, "No License")
34+
@Test func fullName() throws {
35+
#expect(License.mit.fullName == "MIT License")
36+
#expect(License.agpl_3_0.fullName == "GNU Affero General Public License v3.0")
37+
#expect(License.other.fullName == "Unknown or Unrecognised License")
38+
#expect(License.none.fullName == "No License")
3839
}
3940

40-
func test_shortName() throws {
41-
XCTAssertEqual(License.mit.shortName, "MIT")
42-
XCTAssertEqual(License.agpl_3_0.shortName, "AGPL 3.0")
43-
XCTAssertEqual(License.other.shortName, "Unknown license")
44-
XCTAssertEqual(License.none.shortName, "No license")
41+
@Test func shortName() throws {
42+
#expect(License.mit.shortName == "MIT")
43+
#expect(License.agpl_3_0.shortName == "AGPL 3.0")
44+
#expect(License.other.shortName == "Unknown license")
45+
#expect(License.none.shortName == "No license")
4546
}
4647

47-
func test_isCompatibleWithAppStore() throws {
48-
XCTAssertEqual(License.mit.licenseKind, .compatibleWithAppStore)
49-
XCTAssertEqual(License.agpl_3_0.licenseKind, .incompatibleWithAppStore)
50-
XCTAssertEqual(License.other.licenseKind, .other)
51-
XCTAssertEqual(License.none.licenseKind, .none)
48+
@Test func isCompatibleWithAppStore() throws {
49+
#expect(License.mit.licenseKind == .compatibleWithAppStore)
50+
#expect(License.agpl_3_0.licenseKind == .incompatibleWithAppStore)
51+
#expect(License.other.licenseKind == .other)
52+
#expect(License.none.licenseKind == .none)
5253
}
5354

5455
}

0 commit comments

Comments
 (0)