mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-20 22:16:52 +00:00
Run the tests on both node-sqlite3-wasm and better-sqlite3
This commit is contained in:
parent
630b98520f
commit
6724fa804b
BIN
editions/test/store/database.sqlite
Normal file
BIN
editions/test/store/database.sqlite
Normal file
Binary file not shown.
@ -14,11 +14,19 @@ Tests the SQL tiddler database layer
|
||||
|
||||
if($tw.node) {
|
||||
|
||||
describe("SQL tiddler store", function() {
|
||||
describe("SQL tiddler store with node-sqlite3-wasm", function() {
|
||||
runSqlDatabaseTests("wasm");
|
||||
});
|
||||
|
||||
describe("SQL tiddler store with node-sqlite3-wasm", function() {
|
||||
runSqlDatabaseTests("better");
|
||||
});
|
||||
|
||||
function runSqlDatabaseTests(engine) {
|
||||
// Create and initialise the tiddler store
|
||||
var SqlTiddlerDatabase = require("$:/plugins/tiddlywiki/multiwikiserver/sql-tiddler-database.js").SqlTiddlerDatabase;
|
||||
const sqlTiddlerDatabase = new SqlTiddlerDatabase({
|
||||
adminWiki: new $tw.Wiki()
|
||||
engine: engine
|
||||
});
|
||||
sqlTiddlerDatabase.createTables();
|
||||
// Tear down
|
||||
@ -27,7 +35,7 @@ describe("SQL tiddler store", function() {
|
||||
sqlTiddlerDatabase.close();
|
||||
});
|
||||
// Run tests
|
||||
it("should save and retrieve tiddlers", function() {
|
||||
it("should save and retrieve tiddlers using engine: " + engine, function() {
|
||||
// Create bags and recipes
|
||||
sqlTiddlerDatabase.createBag("bag-alpha","Bag alpha");
|
||||
sqlTiddlerDatabase.createBag("bag-beta","Bag beta");
|
||||
@ -88,9 +96,8 @@ describe("SQL tiddler store", function() {
|
||||
// Save a recipe tiddler
|
||||
expect(sqlTiddlerDatabase.saveRecipeTiddler({title: "More", text: "None"},"recipe-rho")).toEqual({tiddler_id: 5, bag_name: 'bag-beta'});
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddler("More","recipe-rho").tiddler).toEqual({title: "More", text: "None"});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user