From 3b4614f8a135b3ca7d919bc3c40d9716b9a2029a Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 10:21:28 +0100 Subject: [PATCH 01/11] Convert ValidateSPIManifestControllerTests --- .../ValidateSPIManifestControllerTests.swift | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Tests/AppTests/ValidateSPIManifestControllerTests.swift b/Tests/AppTests/ValidateSPIManifestControllerTests.swift index 05e4a546c..95ec58b30 100644 --- a/Tests/AppTests/ValidateSPIManifestControllerTests.swift +++ b/Tests/AppTests/ValidateSPIManifestControllerTests.swift @@ -12,26 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -import XCTest - @testable import App import SPIManifest +import Testing -final class ValidateSPIManifestControllerTests: XCTestCase { +@Suite struct ValidateSPIManifestControllerTests { - func test_validationResult_basic() throws { + @Test func validationResult_basic() throws { let yml = ValidateSPIManifest.Model.placeholderManifest // MUT let res = ValidateSPIManifestController.validationResult(manifest: yml) // validate - XCTAssertEqual(res, .valid(try SPIManifest.Manifest(yml: yml))) + #expect(try res == .valid(SPIManifest.Manifest(yml: yml))) } - func test_validationResult_decodingError() throws { + @Test func validationResult_decodingError() throws { let yml = """ broken: """ @@ -40,10 +39,10 @@ final class ValidateSPIManifestControllerTests: XCTestCase { let res = ValidateSPIManifestController.validationResult(manifest: yml) // validate - XCTAssertEqual(res, .invalid("Decoding failed: Key not found: 'version'.")) + #expect(res == .invalid("Decoding failed: Key not found: 'version'.")) } - func test_validationResult_tooLarge() throws { + @Test func validationResult_tooLarge() throws { let targets = (0..<200).map { "Target_\($0)" }.joined(separator: ", ") let yml = """ version: 1 @@ -51,13 +50,13 @@ final class ValidateSPIManifestControllerTests: XCTestCase { configs: - documentation_targets: [\(targets)] """ - XCTAssert(yml.count > SPIManifest.Manifest.maxByteSize) + #expect(yml.count > SPIManifest.Manifest.maxByteSize) // MUT let res = ValidateSPIManifestController.validationResult(manifest: yml) // validate - XCTAssertEqual(res, .invalid("File must not exceed \(SPIManifest.Manifest.maxByteSize) bytes. File size: \(yml.count) bytes.")) + #expect(res == .invalid("File must not exceed \(SPIManifest.Manifest.maxByteSize) bytes. File size: \(yml.count) bytes.")) } } From 856a014aebc1b72ea364a5f3a14c7a2bc24b062c Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 10:27:53 +0100 Subject: [PATCH 02/11] Convert VersionDiffTests --- Tests/AppTests/VersionDiffTests.swift | 113 ++++++++++++-------------- 1 file changed, 52 insertions(+), 61 deletions(-) diff --git a/Tests/AppTests/VersionDiffTests.swift b/Tests/AppTests/VersionDiffTests.swift index 68ab0be67..93f146ba1 100644 --- a/Tests/AppTests/VersionDiffTests.swift +++ b/Tests/AppTests/VersionDiffTests.swift @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +import Foundation + @testable import App -import XCTest +import Testing -class VersionImmutableReferenceDiffTests: XCTestCase { +@Suite struct VersionImmutableReferenceDiffTests { // Tests different version diffing scenarios for lower level // [Version.ImmutableReference] interface. // Scenarios: @@ -27,7 +29,7 @@ class VersionImmutableReferenceDiffTests: XCTestCase { // 4) branch is removed // 5) tag is moved - func test_diff_1() throws { + @Test func diff_1() throws { // Branch changes commit hash // setup let saved: [Version.ImmutableReference] = [ @@ -42,15 +44,12 @@ class VersionImmutableReferenceDiffTests: XCTestCase { ]) // validate - XCTAssertEqual(res.toAdd, - [.init(reference: .branch("main"), commit: "hash3")]) - XCTAssertEqual(res.toDelete, - [.init(reference: .branch("main"), commit: "hash1")]) - XCTAssertEqual(res.toKeep, - [.init(reference: .tag(1, 2, 3), commit: "hash2")]) + #expect(res.toAdd == [.init(reference: .branch("main"), commit: "hash3")]) + #expect(res.toDelete == [.init(reference: .branch("main"), commit: "hash1")]) + #expect(res.toKeep == [.init(reference: .tag(1, 2, 3), commit: "hash2")]) } - func test_diff_2() throws { + @Test func diff_2() throws { // New tag is incoming // setup let saved: [Version.ImmutableReference] = [ @@ -66,15 +65,13 @@ class VersionImmutableReferenceDiffTests: XCTestCase { ]) // validate - XCTAssertEqual(res.toAdd, - [.init(reference: .tag(2, 0, 0), commit: "hash4")]) - XCTAssertEqual(res.toDelete, []) - XCTAssertEqual(res.toKeep, - [.init(reference: .branch("main"), commit: "hash1"), + #expect(res.toAdd == [.init(reference: .tag(2, 0, 0), commit: "hash4")]) + #expect(res.toDelete == []) + #expect(res.toKeep == [.init(reference: .branch("main"), commit: "hash1"), .init(reference: .tag(1, 2, 3), commit: "hash2")]) } - func test_diff_3() throws { + @Test func diff_3() throws { // Tag was deleted upstream // setup let saved: [Version.ImmutableReference] = [ @@ -88,14 +85,12 @@ class VersionImmutableReferenceDiffTests: XCTestCase { ]) // validate - XCTAssertEqual(res.toAdd, []) - XCTAssertEqual(res.toDelete, - [.init(reference: .tag(1, 2, 3), commit: "hash2")]) - XCTAssertEqual(res.toKeep, - [.init(reference: .branch("main"), commit: "hash1")]) + #expect(res.toAdd == []) + #expect(res.toDelete == [.init(reference: .tag(1, 2, 3), commit: "hash2")]) + #expect(res.toKeep == [.init(reference: .branch("main"), commit: "hash1")]) } - func test_diff_4() throws { + @Test func diff_4() throws { // Branch was deleted upstream // setup let saved: [Version.ImmutableReference] = [ @@ -109,14 +104,12 @@ class VersionImmutableReferenceDiffTests: XCTestCase { ]) // validate - XCTAssertEqual(res.toAdd, []) - XCTAssertEqual(res.toDelete, - [.init(reference: .branch("main"), commit: "hash1")]) - XCTAssertEqual(res.toKeep, - [.init(reference: .tag(1, 2, 3), commit: "hash2")]) + #expect(res.toAdd == []) + #expect(res.toDelete == [.init(reference: .branch("main"), commit: "hash1")]) + #expect(res.toKeep == [.init(reference: .tag(1, 2, 3), commit: "hash2")]) } - func test_diff_5() throws { + @Test func diff_5() throws { // Tag was changed - retagging a release // setup let saved: [Version.ImmutableReference] = [ @@ -131,47 +124,45 @@ class VersionImmutableReferenceDiffTests: XCTestCase { ]) // validate - XCTAssertEqual(res.toAdd, [.init(reference: .tag(1, 2, 3), commit: "hash3")]) - XCTAssertEqual(res.toDelete, [.init(reference: .tag(1, 2, 3), commit: "hash2")]) - XCTAssertEqual(res.toKeep, - [.init(reference: .branch("main"), commit: "hash1")]) + #expect(res.toAdd == [.init(reference: .tag(1, 2, 3), commit: "hash3")]) + #expect(res.toDelete == [.init(reference: .tag(1, 2, 3), commit: "hash2")]) + #expect(res.toKeep == [.init(reference: .branch("main"), commit: "hash1")]) } } -class VersionDiffTests: AppTestCase { +@Suite struct VersionDiffTests { // Test [Version] based diff (higher level interface) // Just run an integration scenario, the details are covered in the test above - func test_diff_1() async throws { - // Branch changes commit hash - // setup - let pkg = try await savePackage(on: app.db, "1") - let keptId = UUID() - let saved: [Version] = [ - try .init(package: pkg, commit: "hash1", reference: .branch("main")), - try .init(id: keptId, - package: pkg, commit: "hash2", reference: .tag(1, 2, 3)), - ] - try await saved.save(on: app.db) - - // MUT - let res = Version.diff(local: saved, incoming: [ - try .init(package: pkg, commit: "hash3", reference: .branch("main")), - try .init(package: pkg, commit: "hash2", reference: .tag(1, 2, 3)), - try .init(package: pkg, commit: "hash4", reference: .tag(2, 0, 0)), - ]) - - // validate - XCTAssertEqual(res.toAdd.map(\.immutableReference), - [.init(reference: .branch("main"), commit: "hash3"), - .init(reference: .tag(2, 0, 0), commit: "hash4")]) - XCTAssertEqual(res.toDelete.map(\.immutableReference), - [.init(reference: .branch("main"), commit: "hash1")]) - XCTAssertEqual(res.toKeep.map(\.immutableReference), - [.init(reference: .tag(1, 2, 3), commit: "hash2")]) - XCTAssertEqual(res.toKeep.map(\.id), [keptId]) + @Test func diff_1() async throws { + try await withApp { app in + // Branch changes commit hash + // setup + let pkg = try await savePackage(on: app.db, "1") + let keptId = UUID() + let saved: [Version] = [ + try .init(package: pkg, commit: "hash1", reference: .branch("main")), + try .init(id: keptId, + package: pkg, commit: "hash2", reference: .tag(1, 2, 3)), + ] + try await saved.save(on: app.db) + + // MUT + let res = Version.diff(local: saved, incoming: [ + try .init(package: pkg, commit: "hash3", reference: .branch("main")), + try .init(package: pkg, commit: "hash2", reference: .tag(1, 2, 3)), + try .init(package: pkg, commit: "hash4", reference: .tag(2, 0, 0)), + ]) + + // validate + #expect(res.toAdd.map(\.immutableReference) == [.init(reference: .branch("main"), commit: "hash3"), + .init(reference: .tag(2, 0, 0), commit: "hash4")]) + #expect(res.toDelete.map(\.immutableReference) == [.init(reference: .branch("main"), commit: "hash1")]) + #expect(res.toKeep.map(\.immutableReference) == [.init(reference: .tag(1, 2, 3), commit: "hash2")]) + #expect(res.toKeep.map(\.id) == [keptId]) + } } } From 5b04a6ad8f832eb1da596e439efed98447aed907 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 10:32:11 +0100 Subject: [PATCH 03/11] Cleanup --- Tests/AppTests/VersionDiffTests.swift | 41 ++++++++++++--------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/Tests/AppTests/VersionDiffTests.swift b/Tests/AppTests/VersionDiffTests.swift index 93f146ba1..e586c67ea 100644 --- a/Tests/AppTests/VersionDiffTests.swift +++ b/Tests/AppTests/VersionDiffTests.swift @@ -19,17 +19,17 @@ import Foundation import Testing -@Suite struct VersionImmutableReferenceDiffTests { - // Tests different version diffing scenarios for lower level - // [Version.ImmutableReference] interface. - // Scenarios: - // 1) branch changes commit hash - // 2) new tag is added - // 3) tag is removed - // 4) branch is removed - // 5) tag is moved - - @Test func diff_1() throws { +// Tests different version diffing scenarios for lower level +// [Version.ImmutableReference] interface. +// Scenarios: +// 1) branch changes commit hash +// 2) new tag is added +// 3) tag is removed +// 4) branch is removed +// 5) tag is moved +@Suite struct VersionDiffTests { + + @Test func ImmutableReference_diff_1() throws { // Branch changes commit hash // setup let saved: [Version.ImmutableReference] = [ @@ -49,7 +49,7 @@ import Testing #expect(res.toKeep == [.init(reference: .tag(1, 2, 3), commit: "hash2")]) } - @Test func diff_2() throws { + @Test func ImmutableReference_diff_2() throws { // New tag is incoming // setup let saved: [Version.ImmutableReference] = [ @@ -71,7 +71,7 @@ import Testing .init(reference: .tag(1, 2, 3), commit: "hash2")]) } - @Test func diff_3() throws { + @Test func ImmutableReference_diff_3() throws { // Tag was deleted upstream // setup let saved: [Version.ImmutableReference] = [ @@ -90,7 +90,7 @@ import Testing #expect(res.toKeep == [.init(reference: .branch("main"), commit: "hash1")]) } - @Test func diff_4() throws { + @Test func ImmutableReference_diff_4() throws { // Branch was deleted upstream // setup let saved: [Version.ImmutableReference] = [ @@ -109,7 +109,7 @@ import Testing #expect(res.toKeep == [.init(reference: .tag(1, 2, 3), commit: "hash2")]) } - @Test func diff_5() throws { + @Test func ImmutableReference_diff_5() throws { // Tag was changed - retagging a release // setup let saved: [Version.ImmutableReference] = [ @@ -129,14 +129,9 @@ import Testing #expect(res.toKeep == [.init(reference: .branch("main"), commit: "hash1")]) } -} - - -@Suite struct VersionDiffTests { - // Test [Version] based diff (higher level interface) - // Just run an integration scenario, the details are covered in the test above - - @Test func diff_1() async throws { + @Test func Version_diff_1() async throws { + // Test [Version] based diff (higher level interface) + // Just run an integration scenario, the details are covered in the test above try await withApp { app in // Branch changes commit hash // setup From e38b89f44532e7580469fe735f8530333e497775 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 10:37:44 +0100 Subject: [PATCH 04/11] Convert VersionTests --- Tests/AppTests/VersionTests.swift | 304 +++++++++++++++--------------- 1 file changed, 156 insertions(+), 148 deletions(-) diff --git a/Tests/AppTests/VersionTests.swift b/Tests/AppTests/VersionTests.swift index d936c73da..cf3f89853 100644 --- a/Tests/AppTests/VersionTests.swift +++ b/Tests/AppTests/VersionTests.swift @@ -12,183 +12,191 @@ // See the License for the specific language governing permissions and // limitations under the License. +import Foundation + @testable import App import PostgresKit -import XCTVapor - - -class VersionTests: AppTestCase { - - func test_save() async throws { - // setup - let pkg = try await savePackage(on: app.db, "1".asGithubUrl.url) - let v = try Version(package: pkg) - - // MUT - save to create - try await v.save(on: app.db) - - // validation - XCTAssertEqual(v.$package.id, pkg.id) - - v.commit = "commit" - v.latest = .defaultBranch - v.packageName = "pname" - v.productDependencies = [.init(identity: "foo", name: "Foo", url: "https://github.com/foo/Foo.git", dependencies: [])] - v.publishedAt = Date(timeIntervalSince1970: 1) - v.reference = .branch("branch") - v.releaseNotes = "release notes" - v.resolvedDependencies = [.init(packageName: "foo", - repositoryURL: "http://foo") ] - v.supportedPlatforms = [.ios("13"), .macos("10.15")] - v.swiftVersions = ["4.0", "5.2"].asSwiftVersions - v.url = pkg.versionUrl(for: v.reference) - - // MUT - save to update - try await v.save(on: app.db) - - do { // validation - let v = try await XCTUnwrapAsync(try await Version.find(v.id, on: app.db)) - XCTAssertEqual(v.commit, "commit") - XCTAssertEqual(v.latest, .defaultBranch) - XCTAssertEqual(v.packageName, "pname") - XCTAssertEqual(v.productDependencies, - [.init(identity: "foo", name: "Foo", url: "https://github.com/foo/Foo.git", dependencies: [])]) - XCTAssertEqual(v.publishedAt, Date(timeIntervalSince1970: 1)) - XCTAssertEqual(v.reference, .branch("branch")) - XCTAssertEqual(v.releaseNotes, "release notes") - XCTAssertEqual(v.resolvedDependencies?.map(\.packageName), - ["foo"]) - XCTAssertEqual(v.supportedPlatforms, [.ios("13"), .macos("10.15")]) - XCTAssertEqual(v.swiftVersions, ["4.0", "5.2"].asSwiftVersions) - XCTAssertEqual(v.url, "https://github.com/foo/1/tree/branch") - } - } +import Testing - func test_save_not_null_constraints() async throws { - do { // commit unset - let v = Version() - v.commitDate = .distantPast - v.reference = .branch("main") - try await v.save(on: app.db) - XCTFail("save must fail") - } catch { - // validation - XCTAssertEqual(error.serverMessage, - #"null value in column "commit" of relation "versions" violates not-null constraint"#) - } - do { // commitDate unset - let v = Version() - v.commit = "" - v.reference = .branch("main") +@Suite struct VersionTests { + + @Test func save() async throws { + try await withApp { app in + // setup + let pkg = try await savePackage(on: app.db, "1".asGithubUrl.url) + let v = try Version(package: pkg) + + // MUT - save to create try await v.save(on: app.db) - XCTFail("save must fail") - } catch { + // validation - XCTAssertEqual(error.serverMessage, - #"null value in column "commit_date" of relation "versions" violates not-null constraint"#) + #expect(v.$package.id == pkg.id) + + v.commit = "commit" + v.latest = .defaultBranch + v.packageName = "pname" + v.productDependencies = [.init(identity: "foo", name: "Foo", url: "https://github.com/foo/Foo.git", dependencies: [])] + v.publishedAt = Date(timeIntervalSince1970: 1) + v.reference = .branch("branch") + v.releaseNotes = "release notes" + v.resolvedDependencies = [.init(packageName: "foo", + repositoryURL: "http://foo") ] + v.supportedPlatforms = [.ios("13"), .macos("10.15")] + v.swiftVersions = ["4.0", "5.2"].asSwiftVersions + v.url = pkg.versionUrl(for: v.reference) + + // MUT - save to update + try await v.save(on: app.db) + + do { // validation + let v = try await XCTUnwrapAsync(try await Version.find(v.id, on: app.db)) + #expect(v.commit == "commit") + #expect(v.latest == .defaultBranch) + #expect(v.packageName == "pname") + #expect(v.productDependencies == [.init(identity: "foo", name: "Foo", url: "https://github.com/foo/Foo.git", dependencies: [])]) + #expect(v.publishedAt == Date(timeIntervalSince1970: 1)) + #expect(v.reference == .branch("branch")) + #expect(v.releaseNotes == "release notes") + #expect(v.resolvedDependencies?.map(\.packageName) == ["foo"]) + #expect(v.supportedPlatforms == [.ios("13"), .macos("10.15")]) + #expect(v.swiftVersions == ["4.0", "5.2"].asSwiftVersions) + #expect(v.url == "https://github.com/foo/1/tree/branch") + } } + } - do { // reference unset - let v = Version() - v.commit = "" - v.commitDate = .distantPast - try await v.save(on: app.db) - XCTFail("save must fail") - } catch { - // validation - XCTAssertEqual(error.serverMessage, - #"null value in column "reference" of relation "versions" violates not-null constraint"#) + @Test func save_not_null_constraints() async throws { + try await withApp { app in + do { // commit unset + let v = Version() + v.commitDate = .distantPast + v.reference = .branch("main") + try await v.save(on: app.db) + Issue.record("save must fail") + } catch { + // validation + #expect(error.serverMessage == #"null value in column "commit" of relation "versions" violates not-null constraint"#) + } + + do { // commitDate unset + let v = Version() + v.commit = "" + v.reference = .branch("main") + try await v.save(on: app.db) + Issue.record("save must fail") + } catch { + // validation + #expect(error.serverMessage == #"null value in column "commit_date" of relation "versions" violates not-null constraint"#) + } + + do { // reference unset + let v = Version() + v.commit = "" + v.commitDate = .distantPast + try await v.save(on: app.db) + Issue.record("save must fail") + } catch { + // validation + #expect(error.serverMessage == #"null value in column "reference" of relation "versions" violates not-null constraint"#) + } } } - func test_empty_array_error() async throws { + @Test func empty_array_error() async throws { // Test for // invalid field: swift_versions type: Array error: Unexpected data type: JSONB[]. Expected array. // Fix is .sql(.default("{}")) - // setup - - let pkg = try await savePackage(on: app.db, "1") - let v = try Version(package: pkg) + try await withApp { app in + // setup + let pkg = try await savePackage(on: app.db, "1") + let v = try Version(package: pkg) - // MUT - try await v.save(on: app.db) + // MUT + try await v.save(on: app.db) - // validation - _ = try await XCTUnwrapAsync(try await Version.find(v.id, on: app.db)) + // validation + _ = try await XCTUnwrapAsync(try await Version.find(v.id, on: app.db)) + } } - func test_delete_cascade() async throws { + @Test func delete_cascade() async throws { // delete package must delete version - // setup - let db = app.db - - let pkg = Package(id: UUID(), url: "1") - let ver = try Version(id: UUID(), package: pkg) - try await pkg.save(on: app.db) - try await ver.save(on: app.db) - - try await XCTAssertEqualAsync(try await Package.query(on: db).count(), 1) - try await XCTAssertEqualAsync(try await Version.query(on: db).count(), 1) - - // MUT - try await pkg.delete(on: app.db) - - // version should be deleted - try await XCTAssertEqualAsync(try await Package.query(on: db).count(), 0) - try await XCTAssertEqualAsync(try await Version.query(on: db).count(), 0) + try await withApp { app in + // setup + let pkg = Package(id: UUID(), url: "1") + let ver = try Version(id: UUID(), package: pkg) + try await pkg.save(on: app.db) + try await ver.save(on: app.db) + + try await XCTAssertEqualAsync(try await Package.query(on: app.db).count(), 1) + try await XCTAssertEqualAsync(try await Version.query(on: app.db).count(), 1) + + // MUT + try await pkg.delete(on: app.db) + + // version should be deleted + try await XCTAssertEqualAsync(try await Package.query(on: app.db).count(), 0) + try await XCTAssertEqualAsync(try await Version.query(on: app.db).count(), 0) + } } - func test_isBranch() async throws { - // setup - let pkg = try await savePackage(on: app.db, "1".asGithubUrl.url) - let v1 = try Version(package: pkg, reference: .branch("main")) - let v2 = try Version(package: pkg, reference: .tag(1, 2, 3)) + @Test func isBranch() async throws { + try await withApp { app in + // setup + let pkg = try await savePackage(on: app.db, "1".asGithubUrl.url) + let v1 = try Version(package: pkg, reference: .branch("main")) + let v2 = try Version(package: pkg, reference: .tag(1, 2, 3)) - // MUT & validate - XCTAssertTrue(v1.isBranch) - XCTAssertFalse(v2.isBranch) + // MUT & validate + #expect(v1.isBranch) + #expect(!v2.isBranch) + } } - func test_latestBranchVersion() async throws { - // setup - let pkg = try await savePackage(on: app.db, "1".asGithubUrl.url) - let vid = UUID() - let v1 = try Version(id: UUID(), - package: pkg, - commitDate: .t0, - reference: .branch("main")) - let v2 = try Version(id: UUID(), - package: pkg, - commitDate: .t1, - reference: .branch("main")) - let v3 = try Version(id: vid, - package: pkg, - commitDate: .t2, - reference: .branch("main")) - let v4 = try Version(id: UUID(), package: pkg, reference: .tag(1, 2, 3)) - let v5 = try Version(id: UUID(), package: pkg, reference: .branch("main")) - - // MUT - let latest = [v1, v2, v3, v4, v5].shuffled().latestBranchVersion - - // validate - XCTAssertEqual(latest?.id, vid) + @Test func latestBranchVersion() async throws { + try await withApp { app in + // setup + let pkg = try await savePackage(on: app.db, "1".asGithubUrl.url) + let vid = UUID() + let v1 = try Version(id: UUID(), + package: pkg, + commitDate: .t0, + reference: .branch("main")) + let v2 = try Version(id: UUID(), + package: pkg, + commitDate: .t1, + reference: .branch("main")) + let v3 = try Version(id: vid, + package: pkg, + commitDate: .t2, + reference: .branch("main")) + let v4 = try Version(id: UUID(), package: pkg, reference: .tag(1, 2, 3)) + let v5 = try Version(id: UUID(), package: pkg, reference: .branch("main")) + + // MUT + let latest = [v1, v2, v3, v4, v5].shuffled().latestBranchVersion + + // validate + #expect(latest?.id == vid) + } } - func test_defaults() async throws { - // setup - let pkg = try await savePackage(on: app.db, "1".asGithubUrl.url) - let v = try Version(package: pkg) + @Test func defaults() async throws { + try await withApp { app in + // setup + let pkg = try await savePackage(on: app.db, "1".asGithubUrl.url) + let v = try Version(package: pkg) - // MUT - try await v.save(on: app.db) + // MUT + try await v.save(on: app.db) - do { // validate - let v = try await XCTUnwrapAsync(try await Version.find(v.id, on: app.db)) - XCTAssertEqual(v.resolvedDependencies, nil) - XCTAssertEqual(v.productDependencies, nil) + do { // validate + let v = try await XCTUnwrapAsync(try await Version.find(v.id, on: app.db)) + #expect(v.resolvedDependencies == nil) + #expect(v.productDependencies == nil) + } } } From 0f70fe16f548df997d5e231cc566082fb0584c95 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 10:42:10 +0100 Subject: [PATCH 05/11] Convert ViewUtilsTests --- Tests/AppTests/ViewUtilsTests.swift | 75 ++++++++++++----------------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/Tests/AppTests/ViewUtilsTests.swift b/Tests/AppTests/ViewUtilsTests.swift index 70d728336..40865eb8f 100644 --- a/Tests/AppTests/ViewUtilsTests.swift +++ b/Tests/AppTests/ViewUtilsTests.swift @@ -14,60 +14,47 @@ @testable import App -import XCTest +import Testing -class ViewUtilsTests: XCTestCase { +@Suite struct ViewUtilsTests { - func test_listPhrase() throws { + @Test func test_listPhrase() throws { // test listing 2 and 3 values - XCTAssertEqual(listPhrase(nodes: ["A", "B"]).render(), - "A and B") - XCTAssertEqual(listPhrase(nodes: ["A", "B", "C"]).render(), - "A, B, and C") + #expect(listPhrase(nodes: ["A", "B"]).render() == "A and B") + #expect(listPhrase(nodes: ["A", "B", "C"]).render() == "A, B, and C") // test opening - XCTAssertEqual(listPhrase(opening: "Versions ", nodes: ["A", "B", "C"]).render(), - "Versions A, B, and C") + #expect(listPhrase(opening: "Versions ", nodes: ["A", "B", "C"]).render() == "Versions A, B, and C") // test closing - XCTAssertEqual(listPhrase(nodes: ["A", "B", "C"], closing: ".").render(), - "A, B, and C.") + #expect(listPhrase(nodes: ["A", "B", "C"], closing: ".").render() == "A, B, and C.") // test empty list substitution - XCTAssertEqual(listPhrase(nodes: [], ifEmpty: "none").render(), - "none") + #expect(listPhrase(nodes: [], ifEmpty: "none").render() == "none") // test conjunction - XCTAssertEqual(listPhrase(nodes: ["A", "B"], conjunction: " or ").render(), - "A or B") - XCTAssertEqual(listPhrase(nodes: ["A", "B", "C"], conjunction: " or ").render(), - "A, B, or C") + #expect(listPhrase(nodes: ["A", "B"], conjunction: " or ").render() == "A or B") + #expect(listPhrase(nodes: ["A", "B", "C"], conjunction: " or ").render() == "A, B, or C") } -} - - -// Test that require DB access -class ViewUtilsDBTests: AppTestCase { - - func test_makeLink() async throws { - // setup - let pkg = Package(url: "1") - try await pkg.save(on: app.db) - let version = try Version(package: pkg) - try await version.save(on: app.db) - - do { // branch reference - version.reference = .branch("main") - XCTAssertEqual( - makeLink(packageUrl: "url", version: version), - .init(label: "main", url: "url") - ) - } - - do { // tag reference - version.reference = .tag(1, 2, 3) - XCTAssertEqual( - makeLink(packageUrl: "url", version: version), - .init(label: "1.2.3", url: "url/releases/tag/1.2.3") - ) + @Test func test_makeLink() async throws { + try await withApp { app in + // setup + let pkg = Package(url: "1") + try await pkg.save(on: app.db) + let version = try Version(package: pkg) + try await version.save(on: app.db) + + do { // branch reference + version.reference = .branch("main") + #expect( + makeLink(packageUrl: "url", version: version) == .init(label: "main", url: "url") + ) + } + + do { // tag reference + version.reference = .tag(1, 2, 3) + #expect( + makeLink(packageUrl: "url", version: version) == .init(label: "1.2.3", url: "url/releases/tag/1.2.3") + ) + } } } From 1d70e00b0462ac3d193302e1610852215198107c Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 10:48:21 +0100 Subject: [PATCH 06/11] Add DependenciesProvider --- .../Helpers/DependenciesProvider.swift | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Tests/AppTests/Helpers/DependenciesProvider.swift diff --git a/Tests/AppTests/Helpers/DependenciesProvider.swift b/Tests/AppTests/Helpers/DependenciesProvider.swift new file mode 100644 index 000000000..cd9996bcf --- /dev/null +++ b/Tests/AppTests/Helpers/DependenciesProvider.swift @@ -0,0 +1,35 @@ +// Copyright Dave Verwer, Sven A. Schmidt, and other contributors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Dependencies +import DependenciesTestSupport +import Testing + + +struct DependenciesProvider { + init(updateValues: @escaping @Sendable (inout DependencyValues) -> Void) { + self.updateValues = updateValues + } + + var updateValues: @Sendable (inout DependencyValues) -> Void +} + + +extension Trait where Self == _DependenciesTrait { + static func dependencies( + _ provider: DependenciesProvider + ) -> Self { + .dependencies(provider.updateValues) + } +} From 5653f89c089320959e2640a2edc296f380fffa90 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 11:06:33 +0100 Subject: [PATCH 07/11] Convert WebpageSnapshotTests --- Tests/AppTests/WebpageSnapshotTests.swift | 132 +++++++++++----------- 1 file changed, 65 insertions(+), 67 deletions(-) diff --git a/Tests/AppTests/WebpageSnapshotTests.swift b/Tests/AppTests/WebpageSnapshotTests.swift index fb2f3d9db..0a1e5afa5 100644 --- a/Tests/AppTests/WebpageSnapshotTests.swift +++ b/Tests/AppTests/WebpageSnapshotTests.swift @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -import XCTest - @testable import App import Dependencies @@ -21,27 +19,27 @@ import Ink import Plot import SPIManifest import SnapshotTesting +import Testing import Vapor -class WebpageSnapshotTests: SnapshotTestCase { - - override func setUpWithError() throws { - try super.setUpWithError() +private extension DependenciesProvider { + static var `default`: Self { + .init { + $0.date.now = .t0 + $0.environment.current = { .production } + $0.environment.dbId = { "db-id" } + $0.environment.processingBuildBacklog = { false } + $0.timeZone = .utc + } } +} - override func invokeTest() { - withDependencies { - $0.environment.current = { .production } - $0.environment.dbId = { "db-id" } - $0.environment.processingBuildBacklog = { false } - $0.timeZone = .utc - } operation: { - super.invokeTest() - } - } - func test_HomeIndexView() throws { +@Suite(.dependencies(.default)) +struct WebpageSnapshotTests { + + @Test func HomeIndexView_document() throws { Supporters.mock() let page = { HomeIndex.View(path: "/", model: .mock).document() } @@ -49,7 +47,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_HomeIndexView_development() throws { + @Test func HomeIndexView_document_development() throws { // Test home page to ensure the dev environment is showing the dev banner and `noindex` for robots withDependencies { $0.environment.current = { .development } @@ -62,7 +60,7 @@ class WebpageSnapshotTests: SnapshotTestCase { } } - func test_MaintenanceMessageIndexView() throws { + @Test func MaintenanceMessageIndexView_document() throws { let maintenanceMessage = """ # Server Maintenance @@ -77,7 +75,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView() throws { + @Test func PackageShowView_document() throws { var model = API.PackageController.GetRoute.Model.mock model.homepageUrl = "https://swiftpackageindex.com/" let page = { PackageShow.View(path: "", model: model, packageSchema: .mock).document() } @@ -85,7 +83,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_binary_targets() throws { + @Test func PackageShowView_document_binary_targets() throws { var model = API.PackageController.GetRoute.Model.mock model.homepageUrl = "https://swiftpackageindex.com/" model.hasBinaryTargets = true @@ -95,7 +93,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_few_keywords() throws { + @Test func PackageShowView_document_few_keywords() throws { var model = API.PackageController.GetRoute.Model.mock let keywordsWithCounts = [("tag1", 1), ("tag2", 10), @@ -111,7 +109,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_many_keywords() throws { + @Test func PackageShowView_document_many_keywords() throws { var model = API.PackageController.GetRoute.Model.mock let keywordsWithCounts = [("tag1", 1), ("tag2", 10), ("tag3", 100), ("tag4", 1000), ("tag5", 1234), ("tag6", 1250), ("tag7", 1249), ("tag8", 1251), ("tag9", 12345), @@ -134,7 +132,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_emoji_summary() throws { + @Test func PackageShowView_document_emoji_summary() throws { var model = API.PackageController.GetRoute.Model.mock model.summary = ":package: Nothing but Cache. :octocat:" @@ -143,7 +141,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_open_source_license() throws { + @Test func PackageShowView_document_open_source_license() throws { var model = API.PackageController.GetRoute.Model.mock model.license = .mit model.licenseUrl = "https://example.com/license.html" @@ -152,7 +150,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_app_store_incompatible_license() throws { + @Test func PackageShowView_document_app_store_incompatible_license() throws { var model = API.PackageController.GetRoute.Model.mock model.license = .gpl_3_0 model.licenseUrl = "https://example.com/license.html" @@ -161,7 +159,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_other_license() throws { + @Test func PackageShowView_document_other_license() throws { var model = API.PackageController.GetRoute.Model.mock model.license = .other model.licenseUrl = "https://example.com/license.html" @@ -170,7 +168,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_no_license() throws { + @Test func PackageShowView_document_no_license() throws { var model = API.PackageController.GetRoute.Model.mock model.license = .none model.licenseUrl = nil @@ -179,7 +177,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_no_authors_activity() throws { + @Test func PackageShowView_document_no_authors_activity() throws { // Test to ensure we don't display empty bullet points when there is // no author or activity info var model = API.PackageController.GetRoute.Model.mock @@ -190,7 +188,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_withPackageFundingLinks() throws { + @Test func PackageShowView_document_withPackageFundingLinks() throws { var model = API.PackageController.GetRoute.Model.mock model.fundingLinks = [ .init(platform: .gitHub, url: "https://github.com/sponsor-url"), @@ -203,7 +201,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_with_documentation_link() throws { + @Test func PackageShowView_document_with_documentation_link() throws { var model = API.PackageController.GetRoute.Model.mock model.documentationTarget = .internal(docVersion: .reference("main"), archive: "archive") let page = { PackageShow.View(path: "", model: model, packageSchema: .mock).document() } @@ -211,7 +209,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_single_row_tables() throws { + @Test func PackageShowView_document_single_row_tables() throws { // Test display when all three significant version collapse to a single row var model = API.PackageController.GetRoute.Model.mock do { @@ -243,7 +241,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_no_builds() throws { + @Test func PackageShowView_document_no_builds() throws { // Test display when there are no builds var model = API.PackageController.GetRoute.Model.mock model.swiftVersionBuildInfo = .init(stable: nil, beta: nil, latest: nil) @@ -253,7 +251,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_canonicalURL_noImageSnapshots() throws { + @Test func PackageShowView_document_canonicalURL_noImageSnapshots() throws { // In production, the owner and repository name in the view model are fetched from // the database and have canonical capitalisation. var model = API.PackageController.GetRoute.Model.mock @@ -264,12 +262,12 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageShowView_missingPackage() throws { + @Test func PackageShowView_document_missingPackage() throws { let page = { MissingPackage.View(path: "", model: .mock).document() } assertSnapshot(of: page, as: .html) } - func test_PackageReadmeView() throws { + @Test func PackageReadmeView() throws { let model = PackageReadme.Model.mock let page = { PackageReadme.View(model: model).document() } @@ -277,7 +275,7 @@ class WebpageSnapshotTests: SnapshotTestCase { } // Note: This snapshot test deliberately omits an image snapshot as the HTML being tested has no explicit styling. - func test_PackageReadmeView_unparseableReadme_noImageSnapshots() throws { + @Test func PackageReadmeView_document_unparseableReadme_noImageSnapshots() throws { let model = PackageReadme.Model(url: "https://example.com/owner/repo/README", repositoryOwner: "owner", repositoryName: "repo", @@ -289,14 +287,14 @@ class WebpageSnapshotTests: SnapshotTestCase { } // Note: This snapshot test deliberately omits an image snapshot as the HTML being tested has no explicit styling. - func test_PackageReadmeView_noReadme_noImageSnapshots() throws { + @Test func PackageReadmeView_document_noReadme_noImageSnapshots() throws { let model = PackageReadme.Model.noReadme let page = { PackageReadme.View(model: model).document() } assertSnapshot(of: page, as: .html) } - func test_PackageShowView_customCollection() throws { + @Test func PackageShowView_document_customCollection() throws { var model = API.PackageController.GetRoute.Model.mock model.homepageUrl = "https://swiftpackageindex.com/" model.customCollections = [.init(key: "custom-collection", @@ -307,71 +305,71 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_PackageReleasesView() throws { + @Test func PackageReleasesView_document() throws { let model = PackageReleases.Model.mock let page = { PackageReleases.View(model: model).document() } assertSnapshot(of: page, as: .html) } - func test_PackageReleasesView_NoModel() throws { + @Test func PackageReleasesView_document_NoModel() throws { let page = { PackageReleases.View(model: nil).document() } assertSnapshot(of: page, as: .html) } - func test_ErrorPageView() throws { + @Test func ErrorPageView_document() throws { let page = { ErrorPage.View(path: "", error: Abort(.notFound)).document() } assertSnapshot(of: page, as: .html) } - func test_MarkdownPage() throws { + @Test func MarkdownPage_document() throws { let page = { MarkdownPage(path: "", "privacy.md").document() } assertSnapshot(of: page, as: .html) } - func test_MarkdownPageStyling() throws { - let data = try XCTUnwrap(try fixtureData(for: "markdown-test.md")) - let markdown = try XCTUnwrap(String(data: data, encoding: .utf8)) + @Test func MarkdownPageStyling_document() throws { + let data = try #require(try fixtureData(for: "markdown-test.md")) + let markdown = try #require(String(data: data, encoding: .utf8)) let html = MarkdownParser().parse(markdown).html let page = { MarkdownPage(path: "", html: html).document() } assertSnapshot(of: page, as: .html) } - func test_BuildIndex() throws { + @Test func BuildIndex_document() throws { let page = { BuildIndex.View(path: "", model: .mock).document() } assertSnapshot(of: page, as: .html) } - func test_BuildShow() throws { + @Test func BuildShow_document() throws { let page = { BuildShow.View(path: "", model: .mock).document() } assertSnapshot(of: page, as: .html) } - func test_BuildMonitorIndex() throws { + @Test func BuildMonitorIndex_document() throws { let page = { BuildMonitorIndex.View(path: "", builds: .mock).document() } assertSnapshot(of: page, as: .html) } - func test_MaintainerInfoIndex() throws { + @Test func MaintainerInfoIndex_document() throws { let page = { MaintainerInfoIndex.View(path: "", model: .mock).document() } assertSnapshot(of: page, as: .html) } - func test_AuthorShow() throws { + @Test func AuthorShow_document() throws { let page = { AuthorShow.View(path: "", model: .mock).document() } assertSnapshot(of: page, as: .html) } - func test_SearchShow() throws { + @Test func SearchShow_document() throws { let packageResults: [Search.Result] = [ .package( .init( @@ -449,36 +447,36 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_SearchShow_withFilters() throws { + @Test func SearchShow_document_withFilters() throws { let page = { SearchShow.View(path: "", model: .mockWithFilter()).document() } assertSnapshot(of: page, as: .html) } - func test_SearchShow_withXSSAttempt() throws { + @Test func SearchShow_document_withXSSAttempt() throws { let page = { SearchShow.View(path: "/search?query=%27%3E%22%3E%3C/script%3E%3Csvg/onload=confirm(%27XSS%27)%3E", model: .mockWithXSS()).document() } assertSnapshot(of: page, as: .html) } - func test_KeywordShow() throws { + @Test func KeywordShow_document() throws { let page = { KeywordShow.View(path: "", model: .mock).document() } assertSnapshot(of: page, as: .html) } - func test_CustomCollectionShow() throws { + @Test func CustomCollectionShow_document() throws { let page = { CustomCollectionShow.View(path: "", model: .mock).document() } assertSnapshot(of: page, as: .html) } - func test_DocCTemplate() throws { + @Test func DocCTemplate_processedPage() throws { let doccTemplatePath = fixturesDirectory().appendingPathComponent("docc-template.html").path let doccHtml = try String(contentsOfFile: doccTemplatePath, encoding: .utf8) let archive = DocArchive(name: "archive1", title: "Archive1") - let processor = try XCTUnwrap(DocumentationPageProcessor(repositoryOwner: "owner", + let processor = try #require(DocumentationPageProcessor(repositoryOwner: "owner", repositoryOwnerName: "Owner Name", repositoryName: "package", packageName: "Package Name", @@ -501,11 +499,11 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: processor.processedPage, as: .html) } - func test_DocCTemplate_outdatedStableVersion() throws { + @Test func DocCTemplate_processedPage_outdatedStableVersion() throws { let doccTemplatePath = fixturesDirectory().appendingPathComponent("docc-template.html").path let doccHtml = try String(contentsOfFile: doccTemplatePath, encoding: .utf8) let archive = DocArchive(name: "archive1", title: "Archive1") - let processor = try XCTUnwrap(DocumentationPageProcessor(repositoryOwner: "owner", + let processor = try #require(DocumentationPageProcessor(repositoryOwner: "owner", repositoryOwnerName: "Owner Name", repositoryName: "package", packageName: "Package Name", @@ -532,12 +530,12 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: processor.processedPage, as: .html) } - func test_DocCTemplate_multipleVersions() throws { + @Test func DocCTemplate_processedPage_multipleVersions() throws { let doccTemplatePath = fixturesDirectory().appendingPathComponent("docc-template.html").path let doccHtml = try String(contentsOfFile: doccTemplatePath, encoding: .utf8) let archive1 = DocArchive(name: "archive1", title: "Archive1") let archive2 = DocArchive(name: "archive2", title: "Archive2") - let processor = try XCTUnwrap(DocumentationPageProcessor(repositoryOwner: "owner", + let processor = try #require(DocumentationPageProcessor(repositoryOwner: "owner", repositoryOwnerName: "Owner Name", repositoryName: "package", packageName: "Package Name", @@ -569,7 +567,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: processor.processedPage, as: .html) } - func test_SupportersShow() throws { + @Test func SupportersShow_document() throws { Supporters.mock() let model = SupportersShow.Model() @@ -578,7 +576,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_ReadyForSwift6Show() throws { + @Test func ReadyForSwift6Show_document() throws { withDependencies { $0.fileManager.contents = { @Sendable path in switch path { @@ -645,7 +643,7 @@ class WebpageSnapshotTests: SnapshotTestCase { } } - func test_ValidateSPIManifest_show() throws { + @Test func ValidateSPIManifest_document() throws { let manifest = try SPIManifest.Manifest(yml: ValidateSPIManifest.Model.placeholderManifest) let model = ValidateSPIManifest.Model(validationResult: .valid(manifest)) let page = { ValidateSPIManifest.View(path: "", model: model).document() } @@ -653,7 +651,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_Blog_index() { + @Test func BlogActions_Index_document() { Supporters.mock() let model = BlogActions.Model.mock let page = { BlogActions.Index.View(path: "", model: model).document() } @@ -661,7 +659,7 @@ class WebpageSnapshotTests: SnapshotTestCase { assertSnapshot(of: page, as: .html) } - func test_Blog_show() { + @Test func BlogActions_Show_document() { withDependencies { $0.fileManager.contents = { @Sendable _ in """ From 3e487ee171608d21efa1ab005d76e8d5edf61318 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 11:18:49 +0100 Subject: [PATCH 08/11] Rename snapshots (1) --- Tests/AppTests/WebpageSnapshotTests.swift | 2 +- .../{test_AuthorShow.1.html => AuthorShow_document.1.html} | 0 ...{test_HomeIndexView.1.html => HomeIndexView_document.1.html} | 0 ...lopment.1.html => HomeIndexView_document_development.1.html} | 0 ...xView.1.html => MaintenanceMessageIndexView_document.1.html} | 0 ...ckageReadmeView.1.html => PackageReadmeView_document.1.html} | 0 ...admeView_document_unparseableReadme_noImageSnapshots.1.html} | 0 ...t_PackageShowView.1.html => PackageShowView_document.1.html} | 0 ...kageShowView_document_app_store_incompatible_license.1.html} | 0 ...ts.1.html => PackageShowView_document_binary_targets.1.html} | 0 ...ckageShowView_document_canonicalURL_noImageSnapshots.1.html} | 0 ...ary.1.html => PackageShowView_document_emoji_summary.1.html} | 0 ...ords.1.html => PackageShowView_document_few_keywords.1.html} | 0 ...rds.1.html => PackageShowView_document_many_keywords.1.html} | 0 ...ge.1.html => PackageShowView_document_missingPackage.1.html} | 0 ...html => PackageShowView_document_no_authors_activity.1.html} | 0 ..._builds.1.html => PackageShowView_document_no_builds.1.html} | 0 ...icense.1.html => PackageShowView_document_no_license.1.html} | 0 ...html => PackageShowView_document_open_source_license.1.html} | 0 ...nse.1.html => PackageShowView_document_other_license.1.html} | 0 ...1.html => PackageShowView_document_single_row_tables.1.html} | 0 ... => PackageShowView_document_withPackageFundingLinks.1.html} | 0 ... => PackageShowView_document_with_documentation_link.1.html} | 0 23 files changed, 1 insertion(+), 1 deletion(-) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_AuthorShow.1.html => AuthorShow_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_HomeIndexView.1.html => HomeIndexView_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_HomeIndexView_development.1.html => HomeIndexView_document_development.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_MaintenanceMessageIndexView.1.html => MaintenanceMessageIndexView_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageReadmeView.1.html => PackageReadmeView_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageReadmeView_unparseableReadme_noImageSnapshots.1.html => PackageReadmeView_document_unparseableReadme_noImageSnapshots.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView.1.html => PackageShowView_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_app_store_incompatible_license.1.html => PackageShowView_document_app_store_incompatible_license.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_binary_targets.1.html => PackageShowView_document_binary_targets.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_canonicalURL_noImageSnapshots.1.html => PackageShowView_document_canonicalURL_noImageSnapshots.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_emoji_summary.1.html => PackageShowView_document_emoji_summary.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_few_keywords.1.html => PackageShowView_document_few_keywords.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_many_keywords.1.html => PackageShowView_document_many_keywords.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_missingPackage.1.html => PackageShowView_document_missingPackage.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_no_authors_activity.1.html => PackageShowView_document_no_authors_activity.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_no_builds.1.html => PackageShowView_document_no_builds.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_no_license.1.html => PackageShowView_document_no_license.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_open_source_license.1.html => PackageShowView_document_open_source_license.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_other_license.1.html => PackageShowView_document_other_license.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_single_row_tables.1.html => PackageShowView_document_single_row_tables.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_withPackageFundingLinks.1.html => PackageShowView_document_withPackageFundingLinks.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_with_documentation_link.1.html => PackageShowView_document_with_documentation_link.1.html} (100%) diff --git a/Tests/AppTests/WebpageSnapshotTests.swift b/Tests/AppTests/WebpageSnapshotTests.swift index 0a1e5afa5..f9a93bbfa 100644 --- a/Tests/AppTests/WebpageSnapshotTests.swift +++ b/Tests/AppTests/WebpageSnapshotTests.swift @@ -267,7 +267,7 @@ struct WebpageSnapshotTests { assertSnapshot(of: page, as: .html) } - @Test func PackageReadmeView() throws { + @Test func PackageReadmeView_document() throws { let model = PackageReadme.Model.mock let page = { PackageReadme.View(model: model).document() } diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_AuthorShow.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/AuthorShow_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_AuthorShow.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/AuthorShow_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_HomeIndexView.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndexView_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_HomeIndexView.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndexView_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_HomeIndexView_development.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndexView_document_development.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_HomeIndexView_development.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndexView_document_development.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_MaintenanceMessageIndexView.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MaintenanceMessageIndexView_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_MaintenanceMessageIndexView.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MaintenanceMessageIndexView_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReadmeView.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReadmeView.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReadmeView_unparseableReadme_noImageSnapshots.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document_unparseableReadme_noImageSnapshots.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReadmeView_unparseableReadme_noImageSnapshots.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document_unparseableReadme_noImageSnapshots.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_app_store_incompatible_license.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_app_store_incompatible_license.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_app_store_incompatible_license.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_app_store_incompatible_license.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_binary_targets.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_binary_targets.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_binary_targets.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_binary_targets.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_canonicalURL_noImageSnapshots.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_canonicalURL_noImageSnapshots.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_canonicalURL_noImageSnapshots.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_canonicalURL_noImageSnapshots.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_emoji_summary.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_emoji_summary.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_emoji_summary.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_emoji_summary.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_few_keywords.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_few_keywords.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_few_keywords.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_few_keywords.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_many_keywords.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_many_keywords.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_many_keywords.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_many_keywords.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_missingPackage.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_missingPackage.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_missingPackage.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_missingPackage.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_authors_activity.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_authors_activity.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_authors_activity.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_authors_activity.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_builds.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_builds.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_builds.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_builds.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_license.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_license.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_license.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_license.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_open_source_license.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_open_source_license.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_open_source_license.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_open_source_license.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_other_license.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_other_license.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_other_license.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_other_license.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_single_row_tables.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_single_row_tables.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_single_row_tables.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_single_row_tables.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_withPackageFundingLinks.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_withPackageFundingLinks.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_withPackageFundingLinks.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_withPackageFundingLinks.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_with_documentation_link.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_with_documentation_link.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_with_documentation_link.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_with_documentation_link.1.html From 7221b4dc9cffbde527e7c574852d4961e0943b89 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 11:24:24 +0100 Subject: [PATCH 09/11] Rename snapshots (2) --- Tests/AppTests/WebpageSnapshotTests.swift | 2 +- ...{test_ErrorPageView.1.html => ErrorPageView_document.1.html} | 0 .../{test_MarkdownPage.1.html => MarkdownPage_document.1.html} | 0 ...nPageStyling.1.html => MarkdownPage_document_styling.1.html} | 0 ...PackageReadmeView_document_noReadme_noImageSnapshots.1.html} | 0 ...eReleasesView.1.html => PackageReleasesView_document.1.html} | 0 ...Model.1.html => PackageReleasesView_document_NoModel.1.html} | 0 ....1.html => PackageShowView_document_customCollection.1.html} | 0 8 files changed, 1 insertion(+), 1 deletion(-) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_ErrorPageView.1.html => ErrorPageView_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_MarkdownPage.1.html => MarkdownPage_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_MarkdownPageStyling.1.html => MarkdownPage_document_styling.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageReadmeView_noReadme_noImageSnapshots.1.html => PackageReadmeView_document_noReadme_noImageSnapshots.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageReleasesView.1.html => PackageReleasesView_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageReleasesView_NoModel.1.html => PackageReleasesView_document_NoModel.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_PackageShowView_customCollection.1.html => PackageShowView_document_customCollection.1.html} (100%) diff --git a/Tests/AppTests/WebpageSnapshotTests.swift b/Tests/AppTests/WebpageSnapshotTests.swift index f9a93bbfa..6f258612b 100644 --- a/Tests/AppTests/WebpageSnapshotTests.swift +++ b/Tests/AppTests/WebpageSnapshotTests.swift @@ -330,7 +330,7 @@ struct WebpageSnapshotTests { assertSnapshot(of: page, as: .html) } - @Test func MarkdownPageStyling_document() throws { + @Test func MarkdownPage_document_styling() throws { let data = try #require(try fixtureData(for: "markdown-test.md")) let markdown = try #require(String(data: data, encoding: .utf8)) let html = MarkdownParser().parse(markdown).html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_ErrorPageView.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ErrorPageView_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_ErrorPageView.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ErrorPageView_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_MarkdownPage.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MarkdownPage_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_MarkdownPage.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MarkdownPage_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_MarkdownPageStyling.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MarkdownPage_document_styling.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_MarkdownPageStyling.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MarkdownPage_document_styling.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReadmeView_noReadme_noImageSnapshots.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document_noReadme_noImageSnapshots.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReadmeView_noReadme_noImageSnapshots.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document_noReadme_noImageSnapshots.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReleasesView.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleasesView_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReleasesView.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleasesView_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReleasesView_NoModel.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleasesView_document_NoModel.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageReleasesView_NoModel.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleasesView_document_NoModel.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_customCollection.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_customCollection.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_customCollection.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_customCollection.1.html From 064d1f5f20565bacfb9582d014d64891b900e0ab Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 12:19:51 +0100 Subject: [PATCH 10/11] Rename snapshots (3) --- Tests/AppTests/WebpageSnapshotTests.swift | 3 +-- ...est_Blog_index.1.html => BlogActions_Index_document.1.html} | 0 ...{test_Blog_show.1.html => BlogActions_Show_document.1.html} | 0 .../{test_BuildIndex.1.html => BuildIndex_document.1.html} | 0 ...ldMonitorIndex.1.html => BuildMonitorIndex_document.1.html} | 0 .../{test_BuildShow.1.html => BuildShow_document.1.html} | 0 ...lectionShow.1.html => CustomCollectionShow_document.1.html} | 0 ...t_DocCTemplate.1.html => DocCTemplate_processedPage.1.html} | 0 ...html => DocCTemplate_processedPage_multipleVersions.1.html} | 0 ...=> DocCTemplate_processedPage_outdatedStableVersion.1.html} | 0 .../{test_KeywordShow.1.html => KeywordShow_document.1.html} | 0 ...nerInfoIndex.1.html => MaintainerInfoIndex_document.1.html} | 0 ...ForSwift6Show.1.html => ReadyForSwift6Show_document.1.html} | 0 .../{test_SearchShow.1.html => SearchShow_document.1.html} | 0 ...thFilters.1.html => SearchShow_document_withFilters.1.html} | 0 ...ttempt.1.html => SearchShow_document_withXSSAttempt.1.html} | 0 ...st_SupportersShow.1.html => SupportersShow_document.1.html} | 0 ...anifest_show.1.html => ValidateSPIManifest_document.1.html} | 0 18 files changed, 1 insertion(+), 2 deletions(-) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_Blog_index.1.html => BlogActions_Index_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_Blog_show.1.html => BlogActions_Show_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_BuildIndex.1.html => BuildIndex_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_BuildMonitorIndex.1.html => BuildMonitorIndex_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_BuildShow.1.html => BuildShow_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_CustomCollectionShow.1.html => CustomCollectionShow_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_DocCTemplate.1.html => DocCTemplate_processedPage.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_DocCTemplate_multipleVersions.1.html => DocCTemplate_processedPage_multipleVersions.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_DocCTemplate_outdatedStableVersion.1.html => DocCTemplate_processedPage_outdatedStableVersion.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_KeywordShow.1.html => KeywordShow_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_MaintainerInfoIndex.1.html => MaintainerInfoIndex_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_ReadyForSwift6Show.1.html => ReadyForSwift6Show_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_SearchShow.1.html => SearchShow_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_SearchShow_withFilters.1.html => SearchShow_document_withFilters.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_SearchShow_withXSSAttempt.1.html => SearchShow_document_withXSSAttempt.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_SupportersShow.1.html => SupportersShow_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{test_ValidateSPIManifest_show.1.html => ValidateSPIManifest_document.1.html} (100%) diff --git a/Tests/AppTests/WebpageSnapshotTests.swift b/Tests/AppTests/WebpageSnapshotTests.swift index 6f258612b..cba546d11 100644 --- a/Tests/AppTests/WebpageSnapshotTests.swift +++ b/Tests/AppTests/WebpageSnapshotTests.swift @@ -36,8 +36,7 @@ private extension DependenciesProvider { } -@Suite(.dependencies(.default)) -struct WebpageSnapshotTests { +@Suite(.dependencies(.default)) struct WebpageSnapshotTests { @Test func HomeIndexView_document() throws { Supporters.mock() diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_Blog_index.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BlogActions_Index_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_Blog_index.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BlogActions_Index_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_Blog_show.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BlogActions_Show_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_Blog_show.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BlogActions_Show_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_BuildIndex.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BuildIndex_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_BuildIndex.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BuildIndex_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_BuildMonitorIndex.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BuildMonitorIndex_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_BuildMonitorIndex.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BuildMonitorIndex_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_BuildShow.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BuildShow_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_BuildShow.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/BuildShow_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_CustomCollectionShow.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/CustomCollectionShow_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_CustomCollectionShow.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/CustomCollectionShow_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_DocCTemplate.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/DocCTemplate_processedPage.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_DocCTemplate.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/DocCTemplate_processedPage.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_DocCTemplate_multipleVersions.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/DocCTemplate_processedPage_multipleVersions.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_DocCTemplate_multipleVersions.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/DocCTemplate_processedPage_multipleVersions.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_DocCTemplate_outdatedStableVersion.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/DocCTemplate_processedPage_outdatedStableVersion.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_DocCTemplate_outdatedStableVersion.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/DocCTemplate_processedPage_outdatedStableVersion.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_KeywordShow.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/KeywordShow_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_KeywordShow.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/KeywordShow_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_MaintainerInfoIndex.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MaintainerInfoIndex_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_MaintainerInfoIndex.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MaintainerInfoIndex_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_ReadyForSwift6Show.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ReadyForSwift6Show_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_ReadyForSwift6Show.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ReadyForSwift6Show_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_SearchShow.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_SearchShow.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_SearchShow_withFilters.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document_withFilters.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_SearchShow_withFilters.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document_withFilters.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_SearchShow_withXSSAttempt.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document_withXSSAttempt.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_SearchShow_withXSSAttempt.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document_withXSSAttempt.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_SupportersShow.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SupportersShow_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_SupportersShow.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SupportersShow_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_ValidateSPIManifest_show.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ValidateSPIManifest_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_ValidateSPIManifest_show.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ValidateSPIManifest_document.1.html From f23bd0acf26c14826495f04617358880c1b9329a Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 5 Mar 2025 12:27:20 +0100 Subject: [PATCH 11/11] Make test names more consistent (and shorter) --- Tests/AppTests/WebpageSnapshotTests.swift | 52 +++++++++---------- ...ument.1.html => ErrorPage_document.1.html} | 0 ...ument.1.html => HomeIndex_document.1.html} | 0 ... => HomeIndex_document_development.1.html} | 0 ...> MaintenanceMessageIndex_document.1.html} | 0 ....1.html => MissingPackage_document.1.html} | 0 ...t.1.html => PackageReadme_document.1.html} | 0 ...document_noReadme_noImageSnapshots.1.html} | 0 ...unparseableReadme_noImageSnapshots.1.html} | 0 ...1.html => PackageReleases_document.1.html} | 0 ...> PackageReleases_document_NoModel.1.html} | 0 ...ent.1.html => PackageShow_document.1.html} | 0 ...ent_app_store_incompatible_license.1.html} | 0 ...ackageShow_document_binary_targets.1.html} | 0 ...ment_canonicalURL_noImageSnapshots.1.html} | 0 ...kageShow_document_customCollection.1.html} | 0 ...PackageShow_document_emoji_summary.1.html} | 0 ... PackageShow_document_few_keywords.1.html} | 0 ...PackageShow_document_many_keywords.1.html} | 0 ...eShow_document_no_authors_activity.1.html} | 0 ... => PackageShow_document_no_builds.1.html} | 0 ...=> PackageShow_document_no_license.1.html} | 0 ...eShow_document_open_source_license.1.html} | 0 ...PackageShow_document_other_license.1.html} | 0 ...ageShow_document_single_row_tables.1.html} | 0 ...w_document_withPackageFundingLinks.1.html} | 0 ...w_document_with_documentation_link.1.html} | 0 27 files changed, 26 insertions(+), 26 deletions(-) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{ErrorPageView_document.1.html => ErrorPage_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{HomeIndexView_document.1.html => HomeIndex_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{HomeIndexView_document_development.1.html => HomeIndex_document_development.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{MaintenanceMessageIndexView_document.1.html => MaintenanceMessageIndex_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_missingPackage.1.html => MissingPackage_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageReadmeView_document.1.html => PackageReadme_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageReadmeView_document_noReadme_noImageSnapshots.1.html => PackageReadme_document_noReadme_noImageSnapshots.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageReadmeView_document_unparseableReadme_noImageSnapshots.1.html => PackageReadme_document_unparseableReadme_noImageSnapshots.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageReleasesView_document.1.html => PackageReleases_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageReleasesView_document_NoModel.1.html => PackageReleases_document_NoModel.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document.1.html => PackageShow_document.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_app_store_incompatible_license.1.html => PackageShow_document_app_store_incompatible_license.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_binary_targets.1.html => PackageShow_document_binary_targets.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_canonicalURL_noImageSnapshots.1.html => PackageShow_document_canonicalURL_noImageSnapshots.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_customCollection.1.html => PackageShow_document_customCollection.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_emoji_summary.1.html => PackageShow_document_emoji_summary.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_few_keywords.1.html => PackageShow_document_few_keywords.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_many_keywords.1.html => PackageShow_document_many_keywords.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_no_authors_activity.1.html => PackageShow_document_no_authors_activity.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_no_builds.1.html => PackageShow_document_no_builds.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_no_license.1.html => PackageShow_document_no_license.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_open_source_license.1.html => PackageShow_document_open_source_license.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_other_license.1.html => PackageShow_document_other_license.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_single_row_tables.1.html => PackageShow_document_single_row_tables.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_withPackageFundingLinks.1.html => PackageShow_document_withPackageFundingLinks.1.html} (100%) rename Tests/AppTests/__Snapshots__/WebpageSnapshotTests/{PackageShowView_document_with_documentation_link.1.html => PackageShow_document_with_documentation_link.1.html} (100%) diff --git a/Tests/AppTests/WebpageSnapshotTests.swift b/Tests/AppTests/WebpageSnapshotTests.swift index cba546d11..57c56099d 100644 --- a/Tests/AppTests/WebpageSnapshotTests.swift +++ b/Tests/AppTests/WebpageSnapshotTests.swift @@ -38,7 +38,7 @@ private extension DependenciesProvider { @Suite(.dependencies(.default)) struct WebpageSnapshotTests { - @Test func HomeIndexView_document() throws { + @Test func HomeIndex_document() throws { Supporters.mock() let page = { HomeIndex.View(path: "/", model: .mock).document() } @@ -46,7 +46,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func HomeIndexView_document_development() throws { + @Test func HomeIndex_document_development() throws { // Test home page to ensure the dev environment is showing the dev banner and `noindex` for robots withDependencies { $0.environment.current = { .development } @@ -59,7 +59,7 @@ private extension DependenciesProvider { } } - @Test func MaintenanceMessageIndexView_document() throws { + @Test func MaintenanceMessageIndex_document() throws { let maintenanceMessage = """ # Server Maintenance @@ -74,7 +74,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document() throws { + @Test func PackageShow_document() throws { var model = API.PackageController.GetRoute.Model.mock model.homepageUrl = "https://swiftpackageindex.com/" let page = { PackageShow.View(path: "", model: model, packageSchema: .mock).document() } @@ -82,7 +82,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_binary_targets() throws { + @Test func PackageShow_document_binary_targets() throws { var model = API.PackageController.GetRoute.Model.mock model.homepageUrl = "https://swiftpackageindex.com/" model.hasBinaryTargets = true @@ -92,7 +92,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_few_keywords() throws { + @Test func PackageShow_document_few_keywords() throws { var model = API.PackageController.GetRoute.Model.mock let keywordsWithCounts = [("tag1", 1), ("tag2", 10), @@ -108,7 +108,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_many_keywords() throws { + @Test func PackageShow_document_many_keywords() throws { var model = API.PackageController.GetRoute.Model.mock let keywordsWithCounts = [("tag1", 1), ("tag2", 10), ("tag3", 100), ("tag4", 1000), ("tag5", 1234), ("tag6", 1250), ("tag7", 1249), ("tag8", 1251), ("tag9", 12345), @@ -131,7 +131,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_emoji_summary() throws { + @Test func PackageShow_document_emoji_summary() throws { var model = API.PackageController.GetRoute.Model.mock model.summary = ":package: Nothing but Cache. :octocat:" @@ -140,7 +140,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_open_source_license() throws { + @Test func PackageShow_document_open_source_license() throws { var model = API.PackageController.GetRoute.Model.mock model.license = .mit model.licenseUrl = "https://example.com/license.html" @@ -149,7 +149,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_app_store_incompatible_license() throws { + @Test func PackageShow_document_app_store_incompatible_license() throws { var model = API.PackageController.GetRoute.Model.mock model.license = .gpl_3_0 model.licenseUrl = "https://example.com/license.html" @@ -158,7 +158,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_other_license() throws { + @Test func PackageShow_document_other_license() throws { var model = API.PackageController.GetRoute.Model.mock model.license = .other model.licenseUrl = "https://example.com/license.html" @@ -167,7 +167,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_no_license() throws { + @Test func PackageShow_document_no_license() throws { var model = API.PackageController.GetRoute.Model.mock model.license = .none model.licenseUrl = nil @@ -176,7 +176,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_no_authors_activity() throws { + @Test func PackageShow_document_no_authors_activity() throws { // Test to ensure we don't display empty bullet points when there is // no author or activity info var model = API.PackageController.GetRoute.Model.mock @@ -187,7 +187,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_withPackageFundingLinks() throws { + @Test func PackageShow_document_withPackageFundingLinks() throws { var model = API.PackageController.GetRoute.Model.mock model.fundingLinks = [ .init(platform: .gitHub, url: "https://github.com/sponsor-url"), @@ -200,7 +200,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_with_documentation_link() throws { + @Test func PackageShow_document_with_documentation_link() throws { var model = API.PackageController.GetRoute.Model.mock model.documentationTarget = .internal(docVersion: .reference("main"), archive: "archive") let page = { PackageShow.View(path: "", model: model, packageSchema: .mock).document() } @@ -208,7 +208,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_single_row_tables() throws { + @Test func PackageShow_document_single_row_tables() throws { // Test display when all three significant version collapse to a single row var model = API.PackageController.GetRoute.Model.mock do { @@ -240,7 +240,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_no_builds() throws { + @Test func PackageShow_document_no_builds() throws { // Test display when there are no builds var model = API.PackageController.GetRoute.Model.mock model.swiftVersionBuildInfo = .init(stable: nil, beta: nil, latest: nil) @@ -250,7 +250,7 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_canonicalURL_noImageSnapshots() throws { + @Test func PackageShow_document_canonicalURL_noImageSnapshots() throws { // In production, the owner and repository name in the view model are fetched from // the database and have canonical capitalisation. var model = API.PackageController.GetRoute.Model.mock @@ -261,12 +261,12 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_missingPackage() throws { + @Test func MissingPackage_document() throws { let page = { MissingPackage.View(path: "", model: .mock).document() } assertSnapshot(of: page, as: .html) } - @Test func PackageReadmeView_document() throws { + @Test func PackageReadme_document() throws { let model = PackageReadme.Model.mock let page = { PackageReadme.View(model: model).document() } @@ -274,7 +274,7 @@ private extension DependenciesProvider { } // Note: This snapshot test deliberately omits an image snapshot as the HTML being tested has no explicit styling. - @Test func PackageReadmeView_document_unparseableReadme_noImageSnapshots() throws { + @Test func PackageReadme_document_unparseableReadme_noImageSnapshots() throws { let model = PackageReadme.Model(url: "https://example.com/owner/repo/README", repositoryOwner: "owner", repositoryName: "repo", @@ -286,14 +286,14 @@ private extension DependenciesProvider { } // Note: This snapshot test deliberately omits an image snapshot as the HTML being tested has no explicit styling. - @Test func PackageReadmeView_document_noReadme_noImageSnapshots() throws { + @Test func PackageReadme_document_noReadme_noImageSnapshots() throws { let model = PackageReadme.Model.noReadme let page = { PackageReadme.View(model: model).document() } assertSnapshot(of: page, as: .html) } - @Test func PackageShowView_document_customCollection() throws { + @Test func PackageShow_document_customCollection() throws { var model = API.PackageController.GetRoute.Model.mock model.homepageUrl = "https://swiftpackageindex.com/" model.customCollections = [.init(key: "custom-collection", @@ -304,20 +304,20 @@ private extension DependenciesProvider { assertSnapshot(of: page, as: .html) } - @Test func PackageReleasesView_document() throws { + @Test func PackageReleases_document() throws { let model = PackageReleases.Model.mock let page = { PackageReleases.View(model: model).document() } assertSnapshot(of: page, as: .html) } - @Test func PackageReleasesView_document_NoModel() throws { + @Test func PackageReleases_document_NoModel() throws { let page = { PackageReleases.View(model: nil).document() } assertSnapshot(of: page, as: .html) } - @Test func ErrorPageView_document() throws { + @Test func ErrorPage_document() throws { let page = { ErrorPage.View(path: "", error: Abort(.notFound)).document() } assertSnapshot(of: page, as: .html) diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ErrorPageView_document.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ErrorPage_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ErrorPageView_document.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/ErrorPage_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndexView_document.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndex_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndexView_document.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndex_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndexView_document_development.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndex_document_development.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndexView_document_development.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/HomeIndex_document_development.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MaintenanceMessageIndexView_document.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MaintenanceMessageIndex_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MaintenanceMessageIndexView_document.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MaintenanceMessageIndex_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_missingPackage.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MissingPackage_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_missingPackage.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/MissingPackage_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadme_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadme_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document_noReadme_noImageSnapshots.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadme_document_noReadme_noImageSnapshots.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document_noReadme_noImageSnapshots.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadme_document_noReadme_noImageSnapshots.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document_unparseableReadme_noImageSnapshots.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadme_document_unparseableReadme_noImageSnapshots.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadmeView_document_unparseableReadme_noImageSnapshots.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReadme_document_unparseableReadme_noImageSnapshots.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleasesView_document.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleases_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleasesView_document.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleases_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleasesView_document_NoModel.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleases_document_NoModel.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleasesView_document_NoModel.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageReleases_document_NoModel.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_app_store_incompatible_license.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_app_store_incompatible_license.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_app_store_incompatible_license.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_app_store_incompatible_license.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_binary_targets.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_binary_targets.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_binary_targets.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_binary_targets.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_canonicalURL_noImageSnapshots.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_canonicalURL_noImageSnapshots.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_canonicalURL_noImageSnapshots.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_canonicalURL_noImageSnapshots.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_customCollection.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_customCollection.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_customCollection.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_customCollection.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_emoji_summary.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_emoji_summary.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_emoji_summary.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_emoji_summary.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_few_keywords.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_few_keywords.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_few_keywords.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_few_keywords.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_many_keywords.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_many_keywords.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_many_keywords.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_many_keywords.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_authors_activity.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_no_authors_activity.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_authors_activity.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_no_authors_activity.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_builds.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_no_builds.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_builds.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_no_builds.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_license.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_no_license.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_no_license.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_no_license.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_open_source_license.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_open_source_license.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_open_source_license.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_open_source_license.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_other_license.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_other_license.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_other_license.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_other_license.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_single_row_tables.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_single_row_tables.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_single_row_tables.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_single_row_tables.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_withPackageFundingLinks.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_withPackageFundingLinks.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_withPackageFundingLinks.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_withPackageFundingLinks.1.html diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_with_documentation_link.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_with_documentation_link.1.html similarity index 100% rename from Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShowView_document_with_documentation_link.1.html rename to Tests/AppTests/__Snapshots__/WebpageSnapshotTests/PackageShow_document_with_documentation_link.1.html