zotero/test/tests/storageRequestTest.js
Abe Jellinek 67d2e1cead fx140: Asyncify/ESMify tests
They seem to be succeeding when run individually, but failing when
run as a whole. Not sure why yet.
2025-07-30 22:30:53 -04:00

23 lines
654 B
JavaScript

"use strict";
describe("Zotero.Sync.Storage.Request", function () {
describe("#run()", function () {
it("should run a request and wait for it to complete", async function () {
var libraryID = Zotero.Libraries.userLibraryID;
var count = 0;
var item = await importFileAttachment('test.png');
var request = new Zotero.Sync.Storage.Request({
type: 'download',
libraryID,
name: `${item.libraryID}/${item.key}`,
onStart: async function () {
await Zotero.Promise.delay(25);
count++;
return new Zotero.Sync.Storage.Result;
}
});
var results = await request.start();
assert.equal(count, 1);
})
})
})