diff --git a/browser-version/test/testPersistence.html b/browser-version/test/testPersistence.html index 50d2d7e..2a1d857 100644 --- a/browser-version/test/testPersistence.html +++ b/browser-version/test/testPersistence.html @@ -6,7 +6,7 @@
- + diff --git a/browser-version/test/testPersistence.js b/browser-version/test/testPersistence.js index 8a63bfe..f7b6839 100644 --- a/browser-version/test/testPersistence.js +++ b/browser-version/test/testPersistence.js @@ -1,7 +1,18 @@ console.log("Beginning tests"); +console.log("Please note these tests work on Chrome latest, might not work on other browsers due to discrepancies in how local storage works for the file:// protocol"); -var db = new Nedb({ filename: 'test' }); +function testsFailed () { + document.getElementById("results").innerHTML = "TESTS FAILED"; +} -db.loadDatabase(function (err) { - console.log("LOADING DONE " + err); +localStorage.removeItem('test'); +var db = new Nedb({ filename: 'test', autoload: true }); +db.insert({ hello: 'world' }, function (err) { + if (err) { + testsFailed(); + return; + } + + window.location = './testPersistence2.html'; }); + diff --git a/browser-version/test/testPersistence2.html b/browser-version/test/testPersistence2.html new file mode 100644 index 0000000..b2a057e --- /dev/null +++ b/browser-version/test/testPersistence2.html @@ -0,0 +1,13 @@ + + + + +