Skip to content

Commit 3a59362

Browse files
committed
use pluck flag for tests
1 parent 60c44b6 commit 3a59362

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

databases/catdat/scripts/test.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,11 @@ function test_mutual_structure_duals(type: StructureType) {
8686
*/
8787
function test_positivity(structure_id: string, type: StructureType) {
8888
const unsatisfied_props = db
89-
.prepare<[StructureType, string], { property_id: string }>(
89+
.prepare<[StructureType, string], string>(
9090
`SELECT property_id FROM property_assignments
91-
WHERE
92-
type = ? AND
93-
structure_id = ? AND
94-
is_satisfied = FALSE`,
91+
WHERE type = ? AND structure_id = ? AND is_satisfied = FALSE`,
9592
)
93+
.pluck()
9694
.all(type, structure_id)
9795

9896
if (unsatisfied_props.length > 0) {
@@ -137,20 +135,18 @@ function test_mutual_property_duals(type: StructureType) {
137135
* been decided. If this test fails, property assignments or implications are missing.
138136
*/
139137
function test_decided_structures(structure_ids: string[], type: StructureType) {
140-
const unknown_query = db.prepare<
141-
[StructureType, StructureType, string],
142-
{ id: string }
143-
>(
144-
`SELECT p.id FROM properties p WHERE type = ? AND NOT EXISTS
145-
(SELECT 1 FROM property_assignments
138+
const unknown_query = db
139+
.prepare<[StructureType, StructureType, string], string>(
140+
`SELECT p.id FROM properties p WHERE type = ? AND NOT EXISTS
141+
(
142+
SELECT 1 FROM property_assignments
146143
WHERE type = ? AND structure_id = ? AND property_id = p.id
147-
)
148-
`,
149-
)
144+
)`,
145+
)
146+
.pluck()
150147

151148
for (const structure_id of structure_ids) {
152-
const res = unknown_query.all(type, type, structure_id)
153-
const unknown_properties = res.map((row) => row.id)
149+
const unknown_properties = unknown_query.all(type, type, structure_id)
154150

155151
if (unknown_properties.length > 0) {
156152
throw new Error(

0 commit comments

Comments
 (0)