Skip to content

Commit e51453f

Browse files
committed
more tests
1 parent a844795 commit e51453f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Tests/PostgresNIOTests/New/PSQLRowStreamTests.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ final class PSQLRowStreamTests: XCTestCase {
1919

2020
XCTAssertEqual(try stream.all().wait(), [])
2121
XCTAssertEqual(stream.commandTag, "INSERT 0 1")
22+
23+
// Test 'drain' works in this case
24+
XCTAssertNoThrow(try stream.drain().wait())
2225
}
2326

2427
func testFailedStream() {
@@ -27,9 +30,15 @@ final class PSQLRowStreamTests: XCTestCase {
2730
eventLoop: self.eventLoop,
2831
logger: self.logger
2932
)
30-
33+
34+
let expectedError = PSQLError.serverClosedConnection(underlying: nil)
35+
3136
XCTAssertThrowsError(try stream.all().wait()) {
32-
XCTAssertEqual($0 as? PSQLError, .serverClosedConnection(underlying: nil))
37+
XCTAssertEqual($0 as? PSQLError, expectedError)
38+
}
39+
40+
XCTAssertThrowsError(try stream.drain().wait()) {
41+
XCTAssertEqual($0 as? PSQLError, expectedError)
3342
}
3443
}
3544

0 commit comments

Comments
 (0)