11var sqlite3 = require ( '..' ) ;
22var assert = require ( 'assert' ) ;
3+ var helper = require ( './support/helper' ) ;
34
45describe ( 'patching' , function ( ) {
56 describe ( "Database" , function ( ) {
@@ -20,8 +21,8 @@ describe('patching', function() {
2021 it ( 'allow patching native functions' , function ( ) {
2122 var myFun = function myFunction ( ) {
2223 return "Success" ;
23- }
24-
24+ } ;
25+
2526 assert . doesNotThrow ( ( ) => {
2627 sqlite3 . Database . prototype . close = myFun ;
2728 } ) ;
@@ -91,8 +92,8 @@ describe('patching', function() {
9192 it ( 'allow patching native functions' , function ( ) {
9293 var myFun = function myFunction ( ) {
9394 return "Success" ;
94- }
95-
95+ } ;
96+
9697 assert . doesNotThrow ( ( ) => {
9798 sqlite3 . Statement . prototype . bind = myFun ;
9899 } ) ;
@@ -147,6 +148,10 @@ describe('patching', function() {
147148 var backup ;
148149 var originalFunctions = { } ;
149150
151+ before ( function ( ) {
152+ helper . ensureExists ( 'test/tmp' ) ;
153+ } ) ;
154+
150155 before ( function ( ) {
151156 originalFunctions . step = sqlite3 . Backup . prototype . step ;
152157 originalFunctions . finish = sqlite3 . Backup . prototype . finish ;
@@ -155,8 +160,8 @@ describe('patching', function() {
155160 it ( 'allow patching native functions' , function ( ) {
156161 var myFun = function myFunction ( ) {
157162 return "Success" ;
158- }
159-
163+ } ;
164+
160165 assert . doesNotThrow ( ( ) => {
161166 sqlite3 . Backup . prototype . step = myFun ;
162167 } ) ;
@@ -165,7 +170,7 @@ describe('patching', function() {
165170 } ) ;
166171
167172 db = new sqlite3 . Database ( ':memory:' ) ;
168- backup = db . backup ( "somefile " , myFun ) ;
173+ backup = db . backup ( "test/tmp/patching_backup.db " , myFun ) ;
169174 assert . strictEqual ( backup . step ( ) , "Success" ) ;
170175 assert . strictEqual ( backup . finish ( ) , "Success" ) ;
171176 } ) ;
@@ -176,6 +181,7 @@ describe('patching', function() {
176181 sqlite3 . Backup . prototype . finish = originalFunctions . finish ;
177182 backup . finish ( ) ;
178183 }
184+ helper . deleteFile ( 'test/tmp/patching_backup.db' ) ;
179185 if ( db != null ) {
180186 db . close ( ) ;
181187 }
0 commit comments