Skip to content

Commit 3a692bd

Browse files
committed
test: composite type attributes
1 parent aca5a61 commit 3a692bd

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

test/lib/types.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ test('list', async () => {
55
expect(res.data?.find(({ name }) => name === 'user_status')).toMatchInlineSnapshot(
66
{ id: expect.any(Number) },
77
`
8-
{
8+
Object {
9+
"attributes": Array [],
910
"comment": null,
1011
"enums": [
1112
"ACTIVE",
@@ -54,3 +55,34 @@ test('list types with excluded schemas and include System Schemas', async () =>
5455
expect(type.schema).not.toBe('public')
5556
})
5657
})
58+
59+
test('composite type attributes', async () => {
60+
await pgMeta.query(`create type test_composite as (id int8, data text);`)
61+
62+
const res = await pgMeta.types.list()
63+
expect(res.data?.find(({ name }) => name === 'test_composite')).toMatchInlineSnapshot(
64+
{ id: expect.any(Number) },
65+
`
66+
Object {
67+
"attributes": Array [
68+
Object {
69+
"name": "id",
70+
"type_id": 20,
71+
},
72+
Object {
73+
"name": "data",
74+
"type_id": 25,
75+
},
76+
],
77+
"comment": null,
78+
"enums": Array [],
79+
"format": "test_composite",
80+
"id": Any<Number>,
81+
"name": "test_composite",
82+
"schema": "public",
83+
}
84+
`
85+
)
86+
87+
await pgMeta.query(`drop type test_composite;`)
88+
})

0 commit comments

Comments
 (0)