www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

storageRequestTest.js (670B)


      1 "use strict";
      2 
      3 describe("Zotero.Sync.Storage.Request", function () {
      4 	describe("#run()", function () {
      5 		it("should run a request and wait for it to complete", function* () {
      6 			var libraryID = Zotero.Libraries.userLibraryID;
      7 			var count = 0;
      8 			var item = yield importFileAttachment('test.png');
      9 			var request = new Zotero.Sync.Storage.Request({
     10 				type: 'download',
     11 				libraryID,
     12 				name: `${item.libraryID}/${item.key}`,
     13 				onStart: Zotero.Promise.coroutine(function* () {
     14 					yield Zotero.Promise.delay(25);
     15 					count++;
     16 					return new Zotero.Sync.Storage.Result;
     17 				})
     18 			});
     19 			var results = yield request.start();
     20 			assert.equal(count, 1);
     21 		})
     22 	})
     23 })