@@ -899,6 +899,49 @@ export default class SqliteDriverTest {
899899 ] )
900900 }
901901
902+ @Test ( )
903+ public async shouldBeAbleToUpdateDataUsingARawValueWithoutThrowingCircularStructureError ( { assert } : Context ) {
904+ await this . driver . table ( 'users' ) . create ( { id : '1' , name : 'Robert Kiyosaki' } )
905+
906+ await assert . doesNotReject ( ( ) =>
907+ this . driver
908+ . table ( 'users' )
909+ . where ( 'id' , '1' )
910+ . update ( { name : this . driver . raw ( "'Warren Buffet'" ) } as any )
911+ )
912+
913+ const result = await this . driver . table ( 'users' ) . where ( 'id' , '1' ) . find ( )
914+
915+ assert . containSubset ( result , { id : '1' , name : 'Warren Buffet' } )
916+ }
917+
918+ @Test ( )
919+ public async shouldBeAbleToCreateDataUsingARawValueWithoutThrowingCircularStructureError ( { assert } : Context ) {
920+ await assert . doesNotReject ( ( ) =>
921+ this . driver . table ( 'users' ) . create ( { id : '1' , name : this . driver . raw ( "'Robert Kiyosaki'" ) } as any )
922+ )
923+
924+ const result = await this . driver . table ( 'users' ) . where ( 'id' , '1' ) . find ( )
925+
926+ assert . containSubset ( result , { id : '1' , name : 'Robert Kiyosaki' } )
927+ }
928+
929+ @Test ( )
930+ public async shouldBeAbleToCreateOrUpdateUsingARawValueWithoutThrowingCircularStructureError ( { assert } : Context ) {
931+ await this . driver . table ( 'users' ) . create ( { id : '1' , name : 'Robert Kiyosaki' } )
932+
933+ await assert . doesNotReject ( ( ) =>
934+ this . driver
935+ . table ( 'users' )
936+ . where ( 'id' , '1' )
937+ . createOrUpdate ( { id : '1' , name : this . driver . raw ( "'Warren Buffet'" ) } as any )
938+ )
939+
940+ const result = await this . driver . table ( 'users' ) . where ( 'id' , '1' ) . find ( )
941+
942+ assert . containSubset ( result , { id : '1' , name : 'Warren Buffet' } )
943+ }
944+
902945 @Test ( )
903946 public async shouldBeAbleToDeleteDataUsingDeleteMethod ( { assert } : Context ) {
904947 const data = { id : '1' , name : 'Robert Kiyosaki' }
0 commit comments