fx115: Don't try to spy on IOUtils function in test

Since it doesn't work
This commit is contained in:
Dan Stillman 2023-12-05 06:52:20 -05:00
parent 03d414f3bd
commit 5730bf690e

View file

@ -1434,19 +1434,21 @@ describe("ZoteroPane", function() {
let dialogStub = sinon.stub(zp, 'showLinkedFileFoundAutomaticallyDialog')
.returns('one');
let existsSpy = sinon.spy(OS.File, 'exists');
// No longer works with IOUtils
//let existsSpy = sinon.spy(IOUtils, 'exists');
await zp.checkForLinkedFilesToRelink(attachment);
assert.ok(dialogStub.calledOnce);
assert.ok(dialogStub.calledWith(attachment, sinon.match.string, 0));
assert.ok(existsSpy.calledWith(OS.Path.join(labdSubdir, 'test.pdf')));
assert.notOk(existsSpy.calledWith(OS.Path.join(labdDir, 'test.pdf'))); // Should never get there
//Zotero.debug(existsSpy.calledWith(OS.Path.join(labdSubdir, 'test.pdf')));
//assert.ok(existsSpy.calledWith(OS.Path.join(labdSubdir, 'test.pdf')));
//assert.notOk(existsSpy.calledWith(OS.Path.join(labdDir, 'test.pdf'))); // Should never get there
await assert.eventually.isTrue(attachment.fileExists());
assert.equal(attachment.getFilePath(), labdFile);
assert.equal(attachment.attachmentPath, 'attachments:subdir/test.pdf');
dialogStub.restore();
existsSpy.restore();
//existsSpy.restore();
});
it("should handle Windows paths", async function () {