mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
Cleanup with Table
This commit is contained in:
1 parent
ac94a2f90e
commit
5f549ef6af
4 files changed
+8
-8
No files matched your search
@@ -196,7 +196,7 @@ class ValueObservationFetchTests: GRDBTestCase {
|
||||
func testRemoveDuplicated() throws {
|
||||
try assertValueObservation(
|
||||
ValueObservation
|
||||
.trackingConstantRegion { try Int.fetchOne($0, sql: "SELECT COUNT(*) FROM t")! }
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.removeDuplicates(),
|
||||
records: [0, 1, 2],
|
||||
setup: { db in
|
||||
|
||||
@@ -4,7 +4,7 @@ import GRDB
|
||||
class ValueObservationMapTests: GRDBTestCase {
|
||||
func testMap() throws {
|
||||
let valueObservation = ValueObservation
|
||||
.trackingConstantRegion { try Int.fetchOne($0, sql: "SELECT COUNT(*) FROM t")! }
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.map { "\($0)" }
|
||||
|
||||
try assertValueObservation(
|
||||
|
||||
@@ -66,7 +66,7 @@ class ValueObservationReadonlyTests: GRDBTestCase {
|
||||
try assertValueObservation(
|
||||
observation,
|
||||
fails: { (_: TestError, writer: DatabaseWriter) in
|
||||
let count = try writer.read { try Int.fetchOne($0, sql: "SELECT COUNT(*) FROM t")! }
|
||||
let count = try writer.read(Table("t").fetchCount)
|
||||
XCTAssertEqual(count, 0)
|
||||
},
|
||||
setup: { db in
|
||||
|
||||
@@ -530,7 +530,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
let cancellationExpectation = expectation(description: "cancelled")
|
||||
let observation = ValueObservation
|
||||
.trackingConstantRegion { try Int.fetchOne($0, sql: "SELECT COUNT(*) FROM t")! }
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.handleEvents(didCancel: { cancellationExpectation.fulfill() })
|
||||
|
||||
let task = Task { () -> [Int] in
|
||||
@@ -566,7 +566,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
let cancellationExpectation = expectation(description: "cancelled")
|
||||
let observation = ValueObservation
|
||||
.trackingConstantRegion { try Int.fetchOne($0, sql: "SELECT COUNT(*) FROM t")! }
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.handleEvents(didCancel: { cancellationExpectation.fulfill() })
|
||||
|
||||
let task = Task { @MainActor () -> [Int] in
|
||||
@@ -602,7 +602,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
let cancellationExpectation = expectation(description: "cancelled")
|
||||
let observation = ValueObservation
|
||||
.trackingConstantRegion { try Int.fetchOne($0, sql: "SELECT COUNT(*) FROM t")! }
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.handleEvents(didCancel: { cancellationExpectation.fulfill() })
|
||||
|
||||
let task = Task { () -> [Int] in
|
||||
@@ -642,7 +642,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
|
||||
let cancellationExpectation = expectation(description: "cancelled")
|
||||
let observation = ValueObservation
|
||||
.trackingConstantRegion { try Int.fetchOne($0, sql: "SELECT COUNT(*) FROM t")! }
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.handleEvents(didCancel: { cancellationExpectation.fulfill() })
|
||||
|
||||
let task = Task { @MainActor () -> [Int] in
|
||||
@@ -680,7 +680,7 @@ class ValueObservationTests: GRDBTestCase {
|
||||
let valueExpectation = expectation(description: "value")
|
||||
valueExpectation.assertForOverFulfill = false
|
||||
let observation = ValueObservation
|
||||
.trackingConstantRegion { try Int.fetchOne($0, sql: "SELECT COUNT(*) FROM t")! }
|
||||
.trackingConstantRegion(Table("t").fetchCount)
|
||||
.handleEvents(
|
||||
didReceiveValue: { _ in valueExpectation.fulfill() },
|
||||
didCancel: { cancellationExpectation.fulfill() })
|
||||
|
||||
Reference in new issue
Block a user