Skip to content

Commit 3329e73

Browse files
committed
add key path tests
1 parent b7dfd3f commit 3329e73

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Tests/FluentPostgreSQLTests/FluentPostgreSQLTests.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ class FluentPostgreSQLTests: XCTestCase {
4444

4545
func testNestedStruct() throws {
4646
let conn = try! database.makeConnection(using: .init(), on: eventLoop).await(on: eventLoop)
47+
print(User.codingPath(forKey: \.favoriteColors))
48+
print(User.properties())
4749
try! User.prepare(on: conn).await(on: eventLoop)
4850

51+
4952
let user = try! User(id: nil, name: "Tanner", pet: Pet(name: "Zizek"))
50-
.save(on: conn).await(on: eventLoop)
53+
user.favoriteColors = ["pink", "blue"]
54+
_ = try! user.save(on: conn).await(on: eventLoop)
5155

5256
let fetched = try! User.query(on: conn).first().await(on: eventLoop)
5357

@@ -76,9 +80,11 @@ final class User: PostgreSQLModel, Migration {
7680
var id: Int?
7781
var name: String
7882
var age: Int?
83+
var favoriteColors: [String]
7984
var pet: Pet
8085

8186
init(id: Int? = nil, name: String, pet: Pet) {
87+
self.favoriteColors = []
8288
self.id = id
8389
self.name = name
8490
self.pet = pet

0 commit comments

Comments
 (0)