Skip to content

Commit d62ff64

Browse files
committed
Update test_CustomCollection_reconcile_caseInsensitive
1 parent 2989325 commit d62ff64

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Tests/AppTests/CustomCollectionTests.swift

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,27 +368,24 @@ class CustomCollectionTests: AppTestCase {
368368
}
369369
}
370370

371-
func test_CustomCollection_reconcile_caseSensitive() async throws {
371+
func test_CustomCollection_reconcile_caseInsensitive() async throws {
372372
// Test reconciliation with a case-insensitive matching URL
373373
let collection = CustomCollection(id: .id0, .init(key: "list",
374374
name: "List",
375375
url: "https://github.com/foo/bar/list.json"))
376376
try await collection.save(on: app.db)
377-
try await Package(id: .id1, url: URL("a")).save(on: app.db)
377+
try await Package(id: .id1, url: URL("https://github.com/a.git")).save(on: app.db)
378378

379379
// MUT
380-
try await collection.reconcile(on: app.db, packageURLs: [URL("A")])
380+
try await collection.reconcile(on: app.db, packageURLs: [URL("https://github.com/A.git")])
381381

382382
do { // validate
383-
// The package is not added to the custom collection, because it is not an
384-
// exact match for the package URL.
385-
// This is currently a limitation of the Fluent ~~ operator in the query
386-
// filter(\.$url ~~ urls.map(\.absoluteString))
383+
// The package is added to the custom collection via case-insensitive match
387384
let count = try await CustomCollectionPackage.query(on: app.db).count()
388-
XCTAssertEqual(count, 0)
385+
XCTAssertEqual(count, 1)
389386
let collection = try await CustomCollection.find(.id0, on: app.db).unwrap()
390387
try await collection.$packages.load(on: app.db)
391-
XCTAssertEqual(collection.packages.map(\.url), [])
388+
XCTAssertEqual(collection.packages.map(\.url), ["https://github.com/a.git"])
392389
}
393390
}
394391

0 commit comments

Comments
 (0)