From 7633c7de3047db0f9afcaaf395ee6d43235b2938 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 29 Sep 2015 04:07:26 -0400 Subject: [PATCH] Set test timeout in resetDB() instead of separate this.timeout() calls 'thisArg: this' should be passed to resetDB to have it adjust the timeout --- test/content/support.js | 3 +++ test/tests/supportTest.js | 5 +++-- test/tests/syncEngineTest.js | 7 ++++--- test/tests/syncRunnerTest.js | 7 ++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/test/content/support.js b/test/content/support.js index 5bf428a119..3215e71d37 100644 --- a/test/content/support.js +++ b/test/content/support.js @@ -426,6 +426,9 @@ var getTempDirectory = Zotero.Promise.coroutine(function* getTempDirectory() { * any that were set at startup */ function resetDB(options = {}) { + if (options.thisArg) { + options.thisArg.timeout(60000); + } var db = Zotero.getZoteroDatabase(); return Zotero.reinit(function() { db.remove(false); diff --git a/test/tests/supportTest.js b/test/tests/supportTest.js index 5a8d424670..89a43c377e 100644 --- a/test/tests/supportTest.js +++ b/test/tests/supportTest.js @@ -1,8 +1,9 @@ describe("Support Functions for Unit Testing", function() { describe("resetDB", function() { it("should restore the DB to factory settings", function* () { - this.timeout(60000); - yield resetDB(); + yield resetDB({ + thisArg: this + }); assert.equal((yield Zotero.DB.valueQueryAsync("SELECT COUNT(*) FROM items")), 0); }); }); diff --git a/test/tests/syncEngineTest.js b/test/tests/syncEngineTest.js index 612ae2faf3..83674a5ddb 100644 --- a/test/tests/syncEngineTest.js +++ b/test/tests/syncEngineTest.js @@ -108,8 +108,8 @@ describe("Zotero.Sync.Data.Engine", function () { // Tests // beforeEach(function* () { - this.timeout(60000); yield resetDB({ + thisArg: this, skipBundledFiles: true }); @@ -119,8 +119,9 @@ describe("Zotero.Sync.Data.Engine", function () { yield Zotero.Users.setCurrentUsername("testuser"); }) after(function* () { - this.timeout(60000); - yield resetDB(); + yield resetDB({ + thisArg: this + }); }) describe("Syncing", function () { diff --git a/test/tests/syncRunnerTest.js b/test/tests/syncRunnerTest.js index d9176823b8..454e088116 100644 --- a/test/tests/syncRunnerTest.js +++ b/test/tests/syncRunnerTest.js @@ -445,16 +445,17 @@ describe("Zotero.Sync.Runner", function () { describe("#sync()", function () { before(function* () { - this.timeout(60000); yield resetDB({ + thisArg: this, skipBundledFiles: true }); yield Zotero.Libraries.init(); }) after(function* () { - this.timeout(60000); - yield resetDB(); + yield resetDB({ + thisArg: this + }); }) it("should perform a sync across all libraries", function* () {