Skip to content

Commit 5da1150

Browse files
committed
verify that the trivial category has no unsatisfied property
1 parent d54ee1d commit 5da1150

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

scripts/test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ async function execute_tests() {
2121
await test_mutual_category_duals()
2222
await test_mutual_property_duals()
2323
await test_decided_categories()
24+
await test_properties_of_trivial_category()
2425
await test_properties_of_core_categories()
2526
}
2627

@@ -114,6 +115,24 @@ async function test_decided_category(category_id: string) {
114115
console.info(`✅ All properties have been decided for ${category_id}`)
115116
}
116117

118+
/**
119+
* Tests that the trivial category has no unsatisfied property.
120+
* This enforces that all properties in the database are "positive".
121+
*/
122+
async function test_properties_of_trivial_category() {
123+
const res = await db.execute(`
124+
SELECT property_id FROM category_property_assignments
125+
WHERE category_id = '1' AND is_satisfied = FALSE
126+
`)
127+
if (res.rows.length > 0) {
128+
throw new Error(
129+
`❌ The trivial category has ${res.rows.length} unsatisfied properties, but it should have 0.`,
130+
)
131+
}
132+
133+
console.info(`✅ The trivial category has no unsatisfied properties`)
134+
}
135+
117136
/**
118137
* Tests if the "core categories" (currently: Set, Ab, Top) behave as expected:
119138
* All of their properties in the database have to match those in the

0 commit comments

Comments
 (0)