23 lines
597 B
JavaScript
23 lines
597 B
JavaScript
|
"use strict";
|
||
|
|
||
|
describe("Zotero.Sync.Storage.Request", function () {
|
||
|
describe("#run()", function () {
|
||
|
it("should run a request and wait for it to complete", function* () {
|
||
|
var libraryID = Zotero.Libraries.userLibraryID;
|
||
|
var count = 0;
|
||
|
var request = new Zotero.Sync.Storage.Request({
|
||
|
type: 'download',
|
||
|
libraryID,
|
||
|
name: "1/AAAAAAAA",
|
||
|
onStart: Zotero.Promise.coroutine(function* () {
|
||
|
yield Zotero.Promise.delay(25);
|
||
|
count++;
|
||
|
return new Zotero.Sync.Storage.Result;
|
||
|
})
|
||
|
});
|
||
|
var results = yield request.start();
|
||
|
assert.equal(count, 1);
|
||
|
})
|
||
|
})
|
||
|
})
|