zotero/test/tests/server_integrationTest.js
Abe Jellinek d9550bb5df Server: Expose actual bound port (#4903)
And:
- Use a different port for tests so server tests don't break when Zotero
  is already running
- Remove no-op httpServer.enabled pref updates in tests
   - It's already enabled, no test disables it, and any test that did
     would clean up after itself
   - Updating that pref has no effect without a separate call to
     Zotero.Server.init()
- Remove unused arg to Zotero.Server.init()
2024-12-14 01:16:03 -05:00

32 lines
846 B
JavaScript

"use strict";
describe("MacOS Integration Server", function () {
var serverURL;
before(function* () {
this.timeout(20000);
yield resetDB({
thisArg: this,
skipBundledFiles: true
});
serverURL = `http://127.0.0.1:${Zotero.Server.port}/integration`;
});
describe('/integration/macWordCommand', function () {
it('should call Integration.execCommand with passed parameters', async function () {
let stub = sinon.stub(Zotero.Integration, 'execCommand');
try {
await Zotero.HTTP.request(
'GET',
`${serverURL}/macWordCommand?agent=httpTest&command=httpTestCommand&document=docName&templateVersion=-1`,
);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.firstCall.calledWithExactly('httpTest', 'httpTestCommand', 'docName', '-1'));
} finally {
stub.restore();
}
});
});
});