@@ -262,6 +262,16 @@ describe('/tables', async () => {
262262 assert . equal ( updatedTable . comment , 'foo' )
263263 await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
264264 } )
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+ } )
265275 it ( 'DELETE /tables' , async ( ) => {
266276 const { data : newTable } = await axios . post ( `${ URL } /tables` , { name : 'test' } )
267277
@@ -326,6 +336,23 @@ describe('/tables', async () => {
326336 await axios . delete ( `${ URL } /columns/${ newTable . id } .1` )
327337 await axios . delete ( `${ URL } /tables/${ newTable . id } ` )
328338 } )
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+ } )
329356 it ( 'DELETE /columns' , async ( ) => {
330357 const { data : newTable } = await axios . post ( `${ URL } /tables` , { name : 'foo bar' } )
331358 await axios . post ( `${ URL } /columns` , { table_id : newTable . id , name : 'foo bar' , type : 'int2' } )
0 commit comments