Massively speed up tests
- Make a copy of the database after first initialization that can be swapped in when reinitializing in resetDB() - Avoid unnecessary one-second delay on every reset Probably more that can be done, but this should take minutes off the test runs
This commit is contained in:
parent
88280641ac
commit
f80ba89971
4 changed files with 20 additions and 15 deletions
|
@ -1,10 +1,12 @@
|
|||
describe("Support Functions for Unit Testing", function() {
|
||||
describe("resetDB", function() {
|
||||
it("should restore the DB to factory settings", function* () {
|
||||
yield resetDB({
|
||||
it("should restore the DB to factory settings", async function () {
|
||||
await Zotero.DB.queryAsync("CREATE TABLE testTable (foo INTEGER PRIMARY KEY)");
|
||||
assert.isTrue(await Zotero.DB.tableExists('testTable'));
|
||||
await resetDB({
|
||||
thisArg: this
|
||||
});
|
||||
assert.equal((yield Zotero.DB.valueQueryAsync("SELECT COUNT(*) FROM items")), 0);
|
||||
assert.isFalse(await Zotero.DB.tableExists('testTable'));
|
||||
});
|
||||
});
|
||||
describe("loadSampleData", function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue