diff --git a/Tests/PostgreSQLTests/PostgreSQLConnectionTests.swift b/Tests/PostgreSQLTests/PostgreSQLConnectionTests.swift index 7aab4bdb..73e049bb 100644 --- a/Tests/PostgreSQLTests/PostgreSQLConnectionTests.swift +++ b/Tests/PostgreSQLTests/PostgreSQLConnectionTests.swift @@ -540,6 +540,21 @@ class PostgreSQLConnectionTests: XCTestCase { print(c) } } + + func testUpsert() throws { + let values: [(PostgreSQLUpsert.Identifier, PostgreSQLUpsert.Expression)] = [] + + var upsert: PostgreSQLUpsert + + upsert = PostgreSQLUpsert.upsert(nil, values) + XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("id"))]) + + upsert = PostgreSQLUpsert.upsert([], values) + XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("id"))]) + + upsert = PostgreSQLUpsert.upsert([.column(nil, .identifier("field"))], values) + XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("field"))]) + } static var allTests = [ ("testBenchmark", testBenchmark), @@ -560,6 +575,7 @@ class PostgreSQLConnectionTests: XCTestCase { ("testOrderBy", testOrderBy), ("testInvalidDate", testInvalidDate), ("testEmptyArray", testEmptyArray), + ("testUpsert", testUpsert), ] } diff --git a/Tests/PostgreSQLTests/SqlTests/PostgreSQLUpsertTests.swift b/Tests/PostgreSQLTests/SqlTests/PostgreSQLUpsertTests.swift deleted file mode 100644 index 7b7743b7..00000000 --- a/Tests/PostgreSQLTests/SqlTests/PostgreSQLUpsertTests.swift +++ /dev/null @@ -1,24 +0,0 @@ -import PostgreSQL -import XCTest - -class PostgreSQLUpsertTests: XCTestCase { - - func testUpsert() throws { - let values: [(PostgreSQLUpsert.Identifier, PostgreSQLUpsert.Expression)] = [] - - var upsert: PostgreSQLUpsert - - upsert = PostgreSQLUpsert.upsert(nil, values) - XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("id"))]) - - upsert = PostgreSQLUpsert.upsert([], values) - XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("id"))]) - - upsert = PostgreSQLUpsert.upsert([.column(nil, .identifier("field"))], values) - XCTAssertEqual(upsert.columns, [PostgreSQLColumnIdentifier.column(nil, .identifier("field"))]) - } - - static var allTests = [ - ("testUpsert", testUpsert), - ] -}