Skip to content

Commit eaf6db6

Browse files
committed
add test for nested array, fixes #35
1 parent 31473c2 commit eaf6db6

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Tests/FluentPostgreSQLTests/FluentPostgreSQLTests.swift

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@ class FluentPostgreSQLTests: XCTestCase {
461461

462462
// https://github.com/vapor/fluent-postgresql/issues/85
463463
func testGH85() throws {
464-
/// The Exact enum from my project
465464
enum Availability: UInt8, PostgreSQLRawEnum {
466465
static var allCases: [Availability] = [.everyday, .sunday, .monday, .tuesday, .wednesday, .thursday, .friday, .saturday]
467466

@@ -474,7 +473,7 @@ class FluentPostgreSQLTests: XCTestCase {
474473
case friday
475474
case saturday
476475
}
477-
476+
478477
struct Foo: PostgreSQLModel, Migration {
479478
var id: Int?
480479
var availability: Availability
@@ -491,6 +490,24 @@ class FluentPostgreSQLTests: XCTestCase {
491490
_ = try a.save(on: conn).wait()
492491
}
493492

493+
// https://github.com/vapor/fluent-postgresql/issues/35
494+
func testGH35() throws {
495+
struct Game: PostgreSQLModel, Migration {
496+
var id: Int?
497+
var tags: [Int64]?
498+
}
499+
500+
let conn = try benchmarker.pool.requestConnection().wait()
501+
conn.logger = DatabaseLogger(database: .psql, handler: PrintLogHandler())
502+
defer { benchmarker.pool.releaseConnection(conn) }
503+
504+
try Game.prepare(on: conn).wait()
505+
defer { try? Game.revert(on: conn).wait() }
506+
507+
var a = Game(id: nil, tags: [1, 2, 3])
508+
a = try a.save(on: conn).wait()
509+
}
510+
494511
static let allTests = [
495512
("testBenchmark", testBenchmark),
496513
("testNestedStruct", testNestedStruct),
@@ -508,6 +525,7 @@ class FluentPostgreSQLTests: XCTestCase {
508525
("testCreateOrUpdate", testCreateOrUpdate),
509526
("testEnumArray", testEnumArray),
510527
("testGH85", testGH85),
528+
("testGH35", testGH35),
511529
]
512530
}
513531

0 commit comments

Comments
 (0)