Revert back to original tests-store/data.js
This commit is contained in:
parent
9f992d1ed1
commit
86016b1b68
|
@ -74,12 +74,12 @@ function runSqlDatabaseTests(engine) {
|
|||
});
|
||||
// Verify what we've got
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddlers("recipe-rho")).toEqual([
|
||||
{ title: 'Another Tiddler', tiddler_id: 1, bag_name: 'bag-alpha' },
|
||||
{ title: 'Hello There', tiddler_id: 3, bag_name: 'bag-beta' }
|
||||
{ title: 'Another Tiddler', tiddler_id: 1, bag_name: 'bag-alpha', is_deleted: 0 },
|
||||
{ title: 'Hello There', tiddler_id: 3, bag_name: 'bag-beta', is_deleted: 0 }
|
||||
]);
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddlers("recipe-sigma")).toEqual([
|
||||
{ title: 'Another Tiddler', tiddler_id: 1, bag_name: 'bag-alpha' },
|
||||
{ title: 'Hello There', tiddler_id: 4, bag_name: 'bag-gamma' }
|
||||
{ title: 'Another Tiddler', tiddler_id: 1, bag_name: 'bag-alpha', is_deleted: 0 },
|
||||
{ title: 'Hello There', tiddler_id: 4, bag_name: 'bag-gamma', is_deleted: 0 }
|
||||
]);
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddler("Hello There","recipe-rho").tiddler).toEqual({ title: "Hello There", text: "I'm in beta", tags: "four five six" });
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddler("Missing Tiddler","recipe-rho")).toEqual(null);
|
||||
|
@ -90,17 +90,17 @@ function runSqlDatabaseTests(engine) {
|
|||
// Delete a tiddlers to ensure the underlying tiddler in the recipe shows through
|
||||
sqlTiddlerDatabase.deleteTiddler("Hello There","bag-beta");
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddlers("recipe-rho")).toEqual([
|
||||
{ title: 'Another Tiddler', tiddler_id: 1, bag_name: 'bag-alpha' },
|
||||
{ title: 'Hello There', tiddler_id: 2, bag_name: 'bag-alpha' }
|
||||
{ title: 'Another Tiddler', tiddler_id: 1, bag_name: 'bag-alpha', is_deleted: 0 },
|
||||
{ title: 'Hello There', tiddler_id: 2, bag_name: 'bag-alpha', is_deleted: 0 }
|
||||
]);
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddlers("recipe-sigma")).toEqual([
|
||||
{ title: 'Another Tiddler', tiddler_id: 1, bag_name: 'bag-alpha' },
|
||||
{ title: 'Hello There', tiddler_id: 4, bag_name: 'bag-gamma' }
|
||||
{ title: 'Another Tiddler', tiddler_id: 1, bag_name: 'bag-alpha', is_deleted: 0 },
|
||||
{ title: 'Hello There', tiddler_id: 4, bag_name: 'bag-gamma', is_deleted: 0 }
|
||||
]);
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddler("Hello There","recipe-beta")).toEqual(null);
|
||||
sqlTiddlerDatabase.deleteTiddler("Another Tiddler","bag-alpha");
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddlers("recipe-rho")).toEqual([ { title: 'Hello There', tiddler_id: 2, bag_name: 'bag-alpha' } ]);
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddlers("recipe-sigma")).toEqual([ { title: 'Hello There', tiddler_id: 4, bag_name: 'bag-gamma' } ]);
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddlers("recipe-rho")).toEqual([ { title: 'Hello There', tiddler_id: 2, bag_name: 'bag-alpha', is_deleted: 0 } ]);
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddlers("recipe-sigma")).toEqual([ { title: 'Hello There', tiddler_id: 4, bag_name: 'bag-gamma', is_deleted: 0 } ]);
|
||||
// Save a recipe tiddler
|
||||
expect(sqlTiddlerDatabase.saveRecipeTiddler({title: "More", text: "None"},"recipe-rho")).toEqual({tiddler_id: 7, bag_name: 'bag-beta'});
|
||||
expect(sqlTiddlerDatabase.getRecipeTiddler("More","recipe-rho").tiddler).toEqual({title: "More", text: "None"});
|
||||
|
|
|
@ -85,22 +85,9 @@ function runSqlStoreTests(engine) {
|
|||
|
||||
expect(store.getBagTiddlers("bag-alpha")).toEqual([{title: "Another Tiddler", tiddler_id: 1}]);
|
||||
|
||||
expect(store.getBagRecentTiddlers("bag-alpha")).toEqual({
|
||||
bag_name: "bag-alpha", count: 1, bag_max_tiddler_id: 1, last_known_tiddler_id: 0,
|
||||
tiddlers: [{
|
||||
title: 'Another Tiddler', is_deleted: 0, tiddler_id: 1,
|
||||
fields: { title: 'Another Tiddler', tags: 'one two three', text: "I'm in alpha" }
|
||||
}]
|
||||
});
|
||||
|
||||
var getBagTiddlerResult = store.getBagTiddler("Another Tiddler","bag-alpha");
|
||||
expect(typeof(getBagTiddlerResult.tiddler_id)).toBe("number");
|
||||
delete getBagTiddlerResult.tiddler_id;
|
||||
|
||||
// these fields may eventually be removed, so don't depend on their presence
|
||||
delete getBagTiddlerResult.tiddler.revision;
|
||||
delete getBagTiddlerResult.tiddler.bag;
|
||||
|
||||
expect(getBagTiddlerResult).toEqual({ attachment_blob: null, tiddler: {title: "Another Tiddler", text: "I'm in alpha", tags: "one two three"} });
|
||||
});
|
||||
|
||||
|
@ -136,16 +123,11 @@ function runSqlStoreTests(engine) {
|
|||
expect(typeof(saveRecipeResult.tiddler_id)).toBe("number");
|
||||
expect(saveRecipeResult.bag_name).toBe("bag-beta");
|
||||
|
||||
expect(store.getRecipeTiddlers("recipe-rho")).toEqual([{title: "Another Tiddler", tiddler_id: 1, bag_name: "bag-beta"}]);
|
||||
expect(store.getRecipeTiddlers("recipe-rho")).toEqual([{title: "Another Tiddler", tiddler_id: 1, bag_name: "bag-beta", is_deleted: 0 }]);
|
||||
|
||||
var getRecipeTiddlerResult = store.getRecipeTiddler("Another Tiddler","recipe-rho");
|
||||
expect(typeof(getRecipeTiddlerResult.tiddler_id)).toBe("number");
|
||||
delete getRecipeTiddlerResult.tiddler_id;
|
||||
|
||||
// these fields may eventually be removed, so don't depend on their presence
|
||||
delete getRecipeTiddlerResult.tiddler.revision;
|
||||
delete getRecipeTiddlerResult.tiddler.bag;
|
||||
|
||||
expect(getRecipeTiddlerResult).toEqual({ attachment_blob: null, bag_name: "bag-beta", tiddler: {title: "Another Tiddler", text: "I'm in rho"} });
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue