@@ -4,21 +4,21 @@ import XCTest
4
4
import PostgreSQL
5
5
import TCP
6
6
7
- class PostgreSQLClientTests : XCTestCase {
7
+ class PostgreSQLConnectionTests : XCTestCase {
8
8
func testVersion( ) throws {
9
- let ( client, eventLoop) = try PostgreSQLClient . makeTest ( )
9
+ let ( client, eventLoop) = try PostgreSQLConnection . makeTest ( )
10
10
let results = try client. simpleQuery ( " SELECT version(); " ) . await ( on: eventLoop)
11
11
XCTAssert ( results [ 0 ] [ " version " ] ? . string? . contains ( " 10.1 " ) == true )
12
12
}
13
13
14
14
func testSelectTypes( ) throws {
15
- let ( client, eventLoop) = try PostgreSQLClient . makeTest ( )
15
+ let ( client, eventLoop) = try PostgreSQLConnection . makeTest ( )
16
16
let results = try client. query ( " select * from pg_type; " ) . await ( on: eventLoop)
17
17
XCTAssert ( results. count > 350 )
18
18
}
19
19
20
20
func testParse( ) throws {
21
- let ( client, eventLoop) = try PostgreSQLClient . makeTest ( )
21
+ let ( client, eventLoop) = try PostgreSQLConnection . makeTest ( )
22
22
let query = """
23
23
select * from " pg_type " where " typlen " = $1 or " typlen " = $2
24
24
"""
@@ -33,7 +33,7 @@ class PostgreSQLClientTests: XCTestCase {
33
33
}
34
34
35
35
func testTypes( ) throws {
36
- let ( client, eventLoop) = try PostgreSQLClient . makeTest ( )
36
+ let ( client, eventLoop) = try PostgreSQLConnection . makeTest ( )
37
37
let createQuery = """
38
38
create table kitchen_sink (
39
39
" smallint " smallint,
@@ -123,7 +123,7 @@ class PostgreSQLClientTests: XCTestCase {
123
123
}
124
124
125
125
func testParameterizedTypes( ) throws {
126
- let ( client, eventLoop) = try PostgreSQLClient . makeTest ( )
126
+ let ( client, eventLoop) = try PostgreSQLConnection . makeTest ( )
127
127
let createQuery = """
128
128
create table kitchen_sink (
129
129
" smallint " smallint,
@@ -231,7 +231,7 @@ class PostgreSQLClientTests: XCTestCase {
231
231
}
232
232
233
233
func testParameterizedEncodable( ) throws {
234
- let ( client, eventLoop) = try PostgreSQLClient . makeTest ( )
234
+ let ( client, eventLoop) = try PostgreSQLConnection . makeTest ( )
235
235
_ = try client. query ( " drop table if exists foo; " ) . await ( on: eventLoop)
236
236
let createResult = try client. query ( " create table foo (fooid integer); " ) . await ( on: eventLoop)
237
237
XCTAssertEqual ( createResult. count, 0 )
@@ -256,11 +256,11 @@ class PostgreSQLClientTests: XCTestCase {
256
256
]
257
257
}
258
258
259
- extension PostgreSQLClient {
259
+ extension PostgreSQLConnection {
260
260
/// Creates a test event loop and psql client.
261
- static func makeTest( ) throws -> ( PostgreSQLClient , EventLoop ) {
261
+ static func makeTest( ) throws -> ( PostgreSQLConnection , EventLoop ) {
262
262
let eventLoop = try DefaultEventLoop ( label: " codes.vapor.postgresql.client.test " )
263
- let client = try PostgreSQLClient . connect ( on: eventLoop)
263
+ let client = try PostgreSQLConnection . connect ( on: eventLoop)
264
264
_ = try client. authenticate ( username: " postgres " ) . await ( on: eventLoop)
265
265
return ( client, eventLoop)
266
266
}
0 commit comments