mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
Fix tests that relied on observation of every single changes
This commit is contained in:
1 parent
bf28d1bd85
commit
8b1b3b0396
1 file changed
+12
-12
@@ -769,7 +769,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.handleEvents(didCancel: { cancellationExpectation.fulfill() })
|
||||
|
||||
for try await count in try observation.values(in: writer).prefix(while: { $0 < 3 }) {
|
||||
for try await count in try observation.values(in: writer).prefix(while: { $0 <= 3 }) {
|
||||
counts.append(count)
|
||||
try await writer.write { try $0.execute(sql: "INSERT INTO t DEFAULT VALUES") }
|
||||
}
|
||||
@@ -777,9 +777,9 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
let counts = try await task.value
|
||||
|
||||
// All values were published
|
||||
assertValueObservationRecordingMatch(recorded: counts, expected: [0, 1, 2])
|
||||
XCTAssertTrue(counts.contains(0))
|
||||
XCTAssertTrue(counts.contains(where: { $0 >= 2 }))
|
||||
XCTAssertEqual(counts.sorted(), counts)
|
||||
|
||||
// Observation was ended
|
||||
#if compiler(>=5.8)
|
||||
@@ -807,7 +807,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.handleEvents(didCancel: { cancellationExpectation.fulfill() })
|
||||
|
||||
for try await count in try observation.values(in: writer, scheduling: .immediate).prefix(while: { $0 < 3 }) {
|
||||
for try await count in try observation.values(in: writer, scheduling: .immediate).prefix(while: { $0 <= 3 }) {
|
||||
counts.append(count)
|
||||
try await writer.write { try $0.execute(sql: "INSERT INTO t DEFAULT VALUES") }
|
||||
}
|
||||
@@ -815,9 +815,9 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
let counts = try await task.value
|
||||
|
||||
// All values were published
|
||||
assertValueObservationRecordingMatch(recorded: counts, expected: [0, 1, 2])
|
||||
XCTAssertTrue(counts.contains(0))
|
||||
XCTAssertTrue(counts.contains(where: { $0 >= 2 }))
|
||||
XCTAssertEqual(counts.sorted(), counts)
|
||||
|
||||
// Observation was ended
|
||||
#if compiler(>=5.8)
|
||||
@@ -847,7 +847,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
for try await count in observation.values(in: writer) {
|
||||
counts.append(count)
|
||||
if count == 2 {
|
||||
if count > 3 {
|
||||
break
|
||||
} else {
|
||||
try await writer.write { try $0.execute(sql: "INSERT INTO t DEFAULT VALUES") }
|
||||
@@ -857,9 +857,9 @@ class ValueObservationTests: GRDBTestCase {
|
||||
}
|
||||
|
||||
let counts = try await task.value
|
||||
|
||||
// All values were published
|
||||
assertValueObservationRecordingMatch(recorded: counts, expected: [0, 1, 2])
|
||||
XCTAssertTrue(counts.contains(0))
|
||||
XCTAssertTrue(counts.contains(where: { $0 >= 2 }))
|
||||
XCTAssertEqual(counts.sorted(), counts)
|
||||
|
||||
// Observation was ended
|
||||
#if compiler(>=5.8)
|
||||
|
||||
Reference in new issue
Block a user