Failing tests that exists() returns false when primary key is nil

This commit is contained in:
Gwendal Roué committed 2016-08-10 08:00:27 +02:00
1 parent ff5e171d4a
commit e61550841b
3 files changed
+30

No files matched your search

@@ -394,6 +394,16 @@ class PrimaryKeyMultipleTests: GRDBTestCase {
// MARK: - Exists
func testExistsWithNilPrimaryKeyThatDoesNotMatchAnyRowReturnsFalse() {
assertNoError {
let dbQueue = try makeDatabaseQueue()
dbQueue.inDatabase { db in
let record = Citizenship(personName: nil, countryName: nil, native: true)
XCTAssertFalse(record.exists(db))
}
}
}
func testExistsWithNotNilPrimaryKeyThatDoesNotMatchAnyRowReturnsFalse() {
assertNoError {
let dbQueue = try makeDatabaseQueue()
@@ -537,6 +537,16 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
// MARK: - Exists
func testExistsWithNilPrimaryKeyReturnsFalse() {
assertNoError {
let dbQueue = try makeDatabaseQueue()
dbQueue.inDatabase { db in
let record = Person(id: nil, name: "Arthur")
XCTAssertFalse(record.exists(db))
}
}
}
func testExistsWithNotNilPrimaryKeyThatDoesNotMatchAnyRowReturnsFalse() {
assertNoError {
let dbQueue = try makeDatabaseQueue()
@@ -459,6 +459,16 @@ class PrimaryKeySingleTests: GRDBTestCase {
// MARK: - Exists
func testExistsWithNilPrimaryKeyThatDoesNotMatchAnyRowReturnsFalse() {
assertNoError {
let dbQueue = try makeDatabaseQueue()
dbQueue.inDatabase { db in
let record = Pet(UUID: nil, name: "Bobby")
XCTAssertFalse(record.exists(db))
}
}
}
func testExistsWithNotNilPrimaryKeyThatDoesNotMatchAnyRowReturnsFalse() {
assertNoError {
let dbQueue = try makeDatabaseQueue()