@@ -229,8 +229,9 @@ describe('/tables', async () => {
229
229
assert . equal ( true , ! ! included )
230
230
} )
231
231
it ( 'POST /tables should create a table' , async ( ) => {
232
- const { data : newTable } = await axios . post ( `${ URL } /tables` , { name : 'test' } )
232
+ const { data : newTable } = await axios . post ( `${ URL } /tables` , { name : 'test' , comment : 'foo' } )
233
233
assert . equal ( `${ newTable . schema } .${ newTable . name } ` , 'public.test' )
234
+ assert . equal ( newTable . comment , 'foo' )
234
235
235
236
const { data : tables } = await axios . get ( `${ URL } /tables` )
236
237
const newTableExists = tables . some ( ( table ) => table . id === newTable . id )
@@ -246,10 +247,12 @@ describe('/tables', async () => {
246
247
name : 'test a' ,
247
248
rls_enabled : true ,
248
249
rls_forced : true ,
250
+ comment : 'foo' ,
249
251
} )
250
252
assert . equal ( updatedTable . name , `test a` )
251
253
assert . equal ( updatedTable . rls_enabled , true )
252
254
assert . equal ( updatedTable . rls_forced , true )
255
+ assert . equal ( updatedTable . comment , 'foo' )
253
256
await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
254
257
} )
255
258
it ( 'DELETE /tables' , async ( ) => {
@@ -268,6 +271,7 @@ describe('/tables', async () => {
268
271
type : 'int2' ,
269
272
default_value : 42 ,
270
273
is_nullable : false ,
274
+ comment : 'foo' ,
271
275
// Currently no way to test these:
272
276
// isPrimaryKey: true,
273
277
// isUnique: true,
@@ -280,6 +284,7 @@ describe('/tables', async () => {
280
284
)
281
285
assert . equal ( newColumn . default_value , 42 )
282
286
assert . equal ( newColumn . is_nullable , false )
287
+ assert . equal ( newColumn . comment , 'foo' )
283
288
284
289
await axios . delete ( `${ URL } /columns/${ newTable . id } .1` )
285
290
await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
@@ -291,13 +296,15 @@ describe('/tables', async () => {
291
296
name : 'foo' ,
292
297
type : 'int2' ,
293
298
default_value : 42 ,
299
+ comment : 'foo' ,
294
300
} )
295
301
296
302
await axios . patch ( `${ URL } /columns/${ newTable . id } .1` , {
297
303
name : 'foo bar' ,
298
304
type : 'int4' ,
299
305
drop_default : true ,
300
306
is_nullable : false ,
307
+ comment : 'bar' ,
301
308
} )
302
309
303
310
const { data : columns } = await axios . get ( `${ URL } /columns` )
@@ -307,6 +314,7 @@ describe('/tables', async () => {
307
314
)
308
315
assert . equal ( updatedColumn . default_value , null )
309
316
assert . equal ( updatedColumn . is_nullable , false )
317
+ assert . equal ( updatedColumn . comment , 'bar' )
310
318
311
319
await axios . delete ( `${ URL } /columns/${ newTable . id } .1` )
312
320
await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
0 commit comments