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