File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -550,5 +550,31 @@ for (const [key, factory] of FACTORIES) {
550550 expect ( rc ) . toEqual ( SQLite . SQLITE_OK ) ;
551551 expect ( hasRow ) . toBeFalse ( ) ;
552552 } ) ;
553+
554+ it ( 'does not overwrite update_hook' , async function ( ) {
555+ let rc ;
556+ rc = await sqlite3 . exec ( db , `
557+ CREATE TABLE t(i integer primary key, x);
558+ ` ) ;
559+ expect ( rc ) . toEqual ( SQLite . SQLITE_OK ) ;
560+
561+ let updateHookInvocationsCount = 0 ;
562+ sqlite3 . update_hook ( db , ( ...args ) => {
563+ updateHookInvocationsCount ++ ;
564+ } ) ;
565+
566+ let commitHookInvocationsCount = 0 ;
567+ sqlite3 . commit_hook ( db , ( ) => {
568+ commitHookInvocationsCount ++ ;
569+ } ) ;
570+
571+ rc = await sqlite3 . exec ( db , `
572+ INSERT INTO t VALUES (1, 'foo');
573+ ` ) ;
574+ expect ( rc ) . toEqual ( SQLite . SQLITE_OK ) ;
575+
576+ expect ( updateHookInvocationsCount ) . toEqual ( 1 ) ;
577+ expect ( commitHookInvocationsCount ) . toEqual ( 1 ) ;
578+ } ) ;
553579 } ) ;
554580}
You can’t perform that action at this time.
0 commit comments