@@ -141,16 +141,36 @@ describe('/types', () => {
141
141
assert . equal ( true , ! ! included )
142
142
} )
143
143
} )
144
- describe ( '/tables & /columns' , async ( ) => {
145
- it ( 'GET /tables' , async ( ) => {
144
+ describe ( '/functions' , ( ) => {
145
+ it ( 'GET' , async ( ) => {
146
+ const res = await axios . get ( `${ URL } /functions` )
147
+ // console.log('res.data', res.data)
148
+ const datum = res . data . find ( ( x ) => x . schema == 'public' )
149
+ const notIncluded = res . data . find ( ( x ) => x . schema == 'pg_toast' )
150
+ assert . equal ( res . status , STATUS . SUCCESS )
151
+ assert . equal ( true , ! ! datum )
152
+ assert . equal ( true , ! notIncluded )
153
+ } )
154
+ it ( 'GET with system functions' , async ( ) => {
155
+ const res = await axios . get ( `${ URL } /functions?includeSystemSchemas=true` )
156
+ // console.log('res.data', res.data)
157
+ const datum = res . data . find ( ( x ) => x . schema == 'public' )
158
+ const included = res . data . find ( ( x ) => x . schema == 'pg_catalog' )
159
+ assert . equal ( res . status , STATUS . SUCCESS )
160
+ assert . equal ( true , ! ! datum )
161
+ assert . equal ( true , ! ! included )
162
+ } )
163
+ } )
164
+ describe ( '/tables' , async ( ) => {
165
+ it ( 'GET' , async ( ) => {
146
166
const tables = await axios . get ( `${ URL } /tables` )
147
167
const datum = tables . data . find ( ( x ) => `${ x . schema } .${ x . name } ` === 'public.users' )
148
168
const notIncluded = tables . data . find ( ( x ) => `${ x . schema } .${ x . name } ` === 'pg_catalog.pg_type' )
149
169
assert . equal ( tables . status , STATUS . SUCCESS )
150
170
assert . equal ( true , ! ! datum )
151
171
assert . equal ( true , ! notIncluded )
152
172
} )
153
- it ( '/tables should return the columns' , async ( ) => {
173
+ it ( 'should return the columns, grants, and policies ' , async ( ) => {
154
174
const tables = await axios . get ( `${ URL } /tables` )
155
175
const datum = tables . data . find ( ( x ) => `${ x . schema } .${ x . name } ` === 'public.users' )
156
176
const idColumn = datum . columns . find ( ( x ) => x . name === 'id' )
@@ -161,11 +181,8 @@ describe('/tables & /columns', async () => {
161
181
assert . equal ( idColumn . is_updatable , true )
162
182
assert . equal ( idColumn . is_identity , true )
163
183
assert . equal ( nameColumn . is_identity , false )
164
- } )
165
- it ( '/tables should return the grants' , async ( ) => {
166
- const tables = await axios . get ( `${ URL } /tables` )
167
- const datum = tables . data . find ( ( x ) => `${ x . schema } .${ x . name } ` === 'public.users' )
168
184
assert . equal ( datum . grants . length > 0 , true )
185
+ assert . equal ( datum . policies . length == 0 , true )
169
186
} )
170
187
it ( '/tables should return the relationships' , async ( ) => {
171
188
const tables = await axios . get ( `${ URL } /tables` )
0 commit comments