Skip to content

Commit d8a17a9

Browse files
committed
fix upsert tests
1 parent e085d3d commit d8a17a9

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

Tests/PostgreSQLTests/PostgreSQLConnectionTests.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,21 @@ class PostgreSQLConnectionTests: XCTestCase {
540540
print(c)
541541
}
542542
}
543+
544+
func testUpsert() throws {
545+
let values: [(PostgreSQLUpsert.Identifier, PostgreSQLUpsert.Expression)] = []
546+
547+
var upsert: PostgreSQLUpsert
548+
549+
upsert = PostgreSQLUpsert.upsert(nil, values)
550+
XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("id"))])
551+
552+
upsert = PostgreSQLUpsert.upsert([], values)
553+
XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("id"))])
554+
555+
upsert = PostgreSQLUpsert.upsert([.column(nil, .identifier("field"))], values)
556+
XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("field"))])
557+
}
543558

544559
static var allTests = [
545560
("testBenchmark", testBenchmark),
@@ -560,6 +575,7 @@ class PostgreSQLConnectionTests: XCTestCase {
560575
("testOrderBy", testOrderBy),
561576
("testInvalidDate", testInvalidDate),
562577
("testEmptyArray", testEmptyArray),
578+
("testUpsert", testUpsert),
563579
]
564580
}
565581

Tests/PostgreSQLTests/SqlTests/PostgreSQLUpsertTests.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)