Skip to content

Commit b0f2ee3

Browse files
wasabigeeksoedirgo
authored andcommitted
test: Check that constraint is created
1 parent b659954 commit b0f2ee3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/integration/index.spec.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,18 @@ describe('/tables', async () => {
423423
constraint: "CHECK (description <> '')",
424424
})
425425

426-
// TODO: some way to check constraints?
427-
assert.equal(error, undefined)
426+
const { data: constraints } = await axios.post(
427+
`${URL}/query`,
428+
{ query: `
429+
SELECT pg_get_constraintdef((
430+
SELECT c.oid
431+
FROM pg_constraint c
432+
WHERE c.conrelid = '${newTable.name}'::regclass
433+
));
434+
` }
435+
)
436+
assert.equal(constraints.length, 1)
437+
assert.equal(constraints[0].pg_get_constraintdef, "CHECK ((description <> ''::text))")
428438

429439
await axios.delete(`${URL}/columns/${newTable.id}.1`)
430440
await axios.delete(`${URL}/tables/${newTable.id}`)

0 commit comments

Comments
 (0)