Fix background/stopOnError options for sync engine tests
This commit is contained in:
parent
b30e168c21
commit
7a839e19a6
|
@ -12,24 +12,26 @@ describe("Zotero.Sync.Data.Engine", function () {
|
||||||
var setup = Zotero.Promise.coroutine(function* (options = {}) {
|
var setup = Zotero.Promise.coroutine(function* (options = {}) {
|
||||||
server = sinon.fakeServer.create();
|
server = sinon.fakeServer.create();
|
||||||
server.autoRespond = true;
|
server.autoRespond = true;
|
||||||
|
var background = options.background === undefined ? true : options.background;
|
||||||
|
var stopOnError = options.stopOnError === undefined ? true : options.stopOnError;
|
||||||
|
|
||||||
Components.utils.import("resource://zotero/concurrentCaller.js");
|
Components.utils.import("resource://zotero/concurrentCaller.js");
|
||||||
var caller = new ConcurrentCaller(1);
|
var caller = new ConcurrentCaller(1);
|
||||||
caller.setLogger(msg => Zotero.debug(msg));
|
caller.setLogger(msg => Zotero.debug(msg));
|
||||||
caller.stopOnError = true;
|
caller.stopOnError = stopOnError;
|
||||||
|
|
||||||
var client = new Zotero.Sync.APIClient({
|
var client = new Zotero.Sync.APIClient({
|
||||||
baseURL,
|
baseURL,
|
||||||
apiVersion: options.apiVersion || ZOTERO_CONFIG.API_VERSION,
|
apiVersion: options.apiVersion || ZOTERO_CONFIG.API_VERSION,
|
||||||
apiKey,
|
apiKey,
|
||||||
caller,
|
caller,
|
||||||
background: options.background || true
|
background
|
||||||
});
|
});
|
||||||
|
|
||||||
var engine = new Zotero.Sync.Data.Engine({
|
var engine = new Zotero.Sync.Data.Engine({
|
||||||
apiClient: client,
|
apiClient: client,
|
||||||
libraryID: options.libraryID || Zotero.Libraries.userLibraryID,
|
libraryID: options.libraryID || Zotero.Libraries.userLibraryID,
|
||||||
stopOnError: true
|
stopOnError
|
||||||
});
|
});
|
||||||
|
|
||||||
return { engine, client, caller };
|
return { engine, client, caller };
|
||||||
|
@ -1170,8 +1172,9 @@ describe("Zotero.Sync.Data.Engine", function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should ignore errors when saving downloaded objects", function* () {
|
it("should ignore errors when saving downloaded objects", function* () {
|
||||||
({ engine, client, caller } = yield setup());
|
({ engine, client, caller } = yield setup({
|
||||||
engine.stopOnError = false;
|
stopOnError: false
|
||||||
|
}));
|
||||||
|
|
||||||
var headers = {
|
var headers = {
|
||||||
"Last-Modified-Version": 3
|
"Last-Modified-Version": 3
|
||||||
|
|
Loading…
Reference in New Issue
Block a user