Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Tests/AppTests/PackageCollectionControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ class PackageCollectionControllerTests: AppTestCase {
summary: "summary 1").create(on: app.db)

// MUT
let encoder = self.encoder
try await app.test(
.GET,
"foo/collection.json",
afterResponse: { res async throws in
afterResponse: { @MainActor res async throws in
// validation
XCTAssertEqual(res.status, .ok)
let json = try res.content.decode(PackageCollection.self)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snapshot test here (and the others below) still fail due to the ordering issue. We could skip them for compiler(<6) but it's safer to just let it be for now. If it becomes a problem in day-to-day running we can revisit that.

Expand Down
20 changes: 18 additions & 2 deletions Tests/AppTests/PackageCollectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,13 @@ class PackageCollectionTests: AppTestCase {
keywords: ["key", "word"],
overview: "overview")

// validate
#if compiler(<6)
await MainActor.run { // validate
assertSnapshot(of: res, as: .json(encoder))
}
#else
assertSnapshot(of: res, as: .json(encoder))
#endif
}

func test_generate_from_urls_noResults() async throws {
Expand Down Expand Up @@ -467,8 +472,13 @@ class PackageCollectionTests: AppTestCase {
authorName: "Foo",
keywords: ["key", "word"])

// validate
#if compiler(<6)
await MainActor.run { // validate
assertSnapshot(of: res, as: .json(encoder))
}
#else
assertSnapshot(of: res, as: .json(encoder))
#endif
}

func test_generate_for_owner_noResults() async throws {
Expand Down Expand Up @@ -768,7 +778,13 @@ class PackageCollectionTests: AppTestCase {

// validate signed collection content
XCTAssertFalse(signedCollection.signature.signature.isEmpty)
#if compiler(<6)
await MainActor.run {
assertSnapshot(of: signedCollection, as: .json(encoder))
}
#else
assertSnapshot(of: signedCollection, as: .json(encoder))
#endif

// validate signature
let validated = try await SignedCollection.validate(signedCollection: signedCollection)
Expand Down
Loading