@@ -142,7 +142,7 @@ async function testChainsql(){
142142 // // //创建另一张表,用来测试rename,drop
143143 // await testCreateTable1();
144144 // await testInsert();
145- // await testUpdate();m
145+ // await testUpdate();
146146 // await testDelete();
147147 // await testRename();
148148 // await testGet();
@@ -220,17 +220,25 @@ var testCreateTable1 = async function() {
220220//重复插入的情况下报异常
221221var testInsert = async function ( ) {
222222 var raw = [
223- { 'age' : 333 , 'name' :'hello' } ,
224- { 'age' : 444 , 'name' :'sss' } ,
225- { 'age' : 555 , 'name' :'rrr' }
226- ]
227- var rs = await c . table ( sTableName ) . insert ( raw ) . submit ( { expect :'db_success' } ) ;
228- console . log ( "testInsert" , rs ) ;
223+ { 'id' :1 , 'age' : 333 , 'name' :'hello' } ,
224+ { 'id' :2 , 'age' : 444 , 'name' :'sss' } ,
225+ { 'id' :3 , 'age' : 555 , 'name' :'rrr' }
226+ ] ;
227+ try {
228+ var rs = await c . table ( sTableName ) . insert ( raw ) . submit ( { expect :'db_success' } ) ;
229+ console . log ( "testInsert" , rs ) ;
230+ } catch ( error ) {
231+ console . error ( error ) ;
232+ }
229233}
230234
231235var testUpdate = async function ( ) {
232- var rs = await c . table ( sTableName ) . get ( { 'id' : 2 } ) . update ( { 'age' :200 } ) . submit ( { expect :'db_success' } ) ;
233- console . log ( "testUpdate" , rs ) ;
236+ try {
237+ var rs = await c . table ( sTableName ) . get ( { 'id' : 2 } ) . update ( { 'age' :200 } ) . submit ( { expect :'db_success' } ) ;
238+ console . log ( "testUpdate" , rs ) ;
239+ } catch ( error ) {
240+ console . error ( error ) ;
241+ }
234242}
235243
236244var testDelete = async function ( ) {
0 commit comments