aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/tester1.c-pp.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wasm/tester1.c-pp.js')
-rw-r--r--ext/wasm/tester1.c-pp.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js
index db4b50f4b..c1b16d5e8 100644
--- a/ext/wasm/tester1.c-pp.js
+++ b/ext/wasm/tester1.c-pp.js
@@ -353,7 +353,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const sahPoolConfig = {
name: 'opfs-sahpool-tester1',
clearOnInit: true,
- initialCapacity: 3
+ initialCapacity: 6
};
////////////////////////////////////////////////////////////////////////
// End of infrastructure setup. Now define the tests...
@@ -3076,7 +3076,24 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
T.assert(1 === fileNames.length)
.assert(dbName === fileNames[0])
.assert(1 === u1.getFileCount())
- .assert(true === u1.unlink(dbName))
+
+ if(1){ // test exportFile() and importDb()
+ const dbytes = u1.exportFile(dbName);
+ T.assert(dbytes.length >= 4096);
+ const dbName2 = '/exported.db';
+ u1.importDb(dbName2, dbytes);
+ T.assert( 2 == u1.getFileCount() );
+ let db2 = new u1.OpfsSAHPoolDb(dbName2);
+ T.assert(db2 instanceof sqlite3.oo1.DB)
+ .assert(3 === db2.selectValue('select count(*) from t'));
+ db2.close();
+ T.assert(true === u1.unlink(dbName2))
+ .assert(false === u1.unlink(dbName2))
+ .assert(1 === u1.getFileCount())
+ .assert(1 === u1.getFileNames().length);
+ }
+
+ T.assert(true === u1.unlink(dbName))
.assert(false === u1.unlink(dbName))
.assert(0 === u1.getFileCount())
.assert(0 === u1.getFileNames().length);
@@ -3089,6 +3106,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
log("Installed second SAH instance as",conf2.name);
T.assert(0 === POther.getFileCount())
.assert(true === await POther.removeVfs());
+
if(0){
/* Enable this block to inspect vfs's contents via the dev
console or OPFS Explorer browser extension. The