Skip to content

Commit ac6f814

Browse files
committed
wip
1 parent 29fcd86 commit ac6f814

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Tests/StructuredQueriesTests/DatabaseFunctionTests.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,5 +427,29 @@ extension SnapshotTests {
427427
"""
428428
}
429429
}
430+
431+
@DatabaseFunction
432+
func isValidDraft(_ tag: Tag.Draft) -> Bool {
433+
!tag.title.isEmpty
434+
}
435+
@Test func tableDraft() {
436+
$isValidDraft.install(database.handle)
437+
438+
assertQuery(
439+
Tag.Draft.select { $isValidDraft($0) }.limit(1)
440+
) {
441+
"""
442+
SELECT "isValidDraft"("tags"."id", "tags"."title")
443+
FROM "tags"
444+
LIMIT 1
445+
"""
446+
} results: {
447+
"""
448+
┌──────┐
449+
│ true │
450+
└──────┘
451+
"""
452+
}
453+
}
430454
}
431455
}

0 commit comments

Comments
 (0)