@@ -262,6 +262,16 @@ describe('/tables', async () => {
262
262
assert . equal ( updatedTable . comment , 'foo' )
263
263
await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
264
264
} )
265
+ it ( 'PATCH /tables same name' , async ( ) => {
266
+ const { data : newTable } = await axios . post ( `${ URL } /tables` , {
267
+ name : 'test' ,
268
+ } )
269
+ let { data : updatedTable } = await axios . patch ( `${ URL } /tables/${ newTable . id } ` , {
270
+ name : 'test' ,
271
+ } )
272
+ assert . equal ( updatedTable . name , `test` )
273
+ await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
274
+ } )
265
275
it ( 'DELETE /tables' , async ( ) => {
266
276
const { data : newTable } = await axios . post ( `${ URL } /tables` , { name : 'test' } )
267
277
@@ -326,6 +336,23 @@ describe('/tables', async () => {
326
336
await axios . delete ( `${ URL } /columns/${ newTable . id } .1` )
327
337
await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
328
338
} )
339
+ it ( 'PATCH /columns same name' , async ( ) => {
340
+ const { data : newTable } = await axios . post ( `${ URL } /tables` , { name : 'foo' } )
341
+ await axios . post ( `${ URL } /columns` , {
342
+ table_id : newTable . id ,
343
+ name : 'bar' ,
344
+ type : 'int2' ,
345
+ } )
346
+
347
+ const { data : updatedColumn } = await axios . patch ( `${ URL } /columns/${ newTable . id } .1` , {
348
+ name : 'bar' ,
349
+ } )
350
+
351
+ assert . equal ( updatedColumn . name , 'bar' )
352
+
353
+ await axios . delete ( `${ URL } /columns/${ newTable . id } .1` )
354
+ await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
355
+ } )
329
356
it ( 'DELETE /columns' , async ( ) => {
330
357
const { data : newTable } = await axios . post ( `${ URL } /tables` , { name : 'foo bar' } )
331
358
await axios . post ( `${ URL } /columns` , { table_id : newTable . id , name : 'foo bar' , type : 'int2' } )
0 commit comments