mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Failing test for #1383 (async version)
This commit is contained in:
1 parent
73b279b5c1
commit
4ab8ac8d3f
1 file changed
+30
@@ -1175,4 +1175,34 @@ class ValueObservationTests: GRDBTestCase {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for <https://github.com/groue/GRDB.swift/issues/1383>
|
||||
func testIssue1383_async() throws {
|
||||
do {
|
||||
let dbPool = try makeDatabasePool(filename: "test")
|
||||
try dbPool.writeWithoutTransaction { db in
|
||||
try db.execute(sql: "CREATE TABLE t(a)")
|
||||
try db.checkpoint(.truncate)
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
let dbPool = try makeDatabasePool(filename: "test")
|
||||
let observation = ValueObservation.tracking(Table("t").fetchCount)
|
||||
let expectation = self.expectation(description: "completion")
|
||||
expectation.assertForOverFulfill = false
|
||||
let cancellable = observation.start(
|
||||
in: dbPool,
|
||||
onError: { error in
|
||||
XCTFail("Unexpected error \(error)")
|
||||
expectation.fulfill()
|
||||
},
|
||||
onChange: { _ in
|
||||
expectation.fulfill()
|
||||
})
|
||||
withExtendedLifetime(cancellable) { _ in
|
||||
wait(for: [expectation], timeout: 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user