2016-12-10 22:07:37 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
describe("Zotero", function() {
|
2018-05-16 00:18:41 +00:00
|
|
|
describe("VersionHeader", function () {
|
|
|
|
describe("#update()", function () {
|
|
|
|
var majorMinorVersion;
|
|
|
|
|
|
|
|
before(function () {
|
|
|
|
majorMinorVersion = Zotero.version.replace(/(\d+\.\d+).*/, '$1');
|
|
|
|
});
|
|
|
|
|
2018-08-16 02:06:51 +00:00
|
|
|
it("should replace app name with Firefox", function () {
|
|
|
|
var platformVersion = Services.appinfo.platformVersion.match(/^\d+/)[0] + '.0';
|
|
|
|
var ua1 = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 ${Zotero.clientName}/${Zotero.version}`;
|
|
|
|
var ua2 = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/${platformVersion}`;
|
|
|
|
assert.equal(Zotero.VersionHeader.update('example.com', ua1, ZOTERO_CONFIG.CLIENT_NAME), ua2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should show Chrome user agent unchanged", function () {
|
2018-05-16 00:18:41 +00:00
|
|
|
var ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36';
|
2018-08-16 02:06:51 +00:00
|
|
|
assert.equal(Zotero.VersionHeader.update('example.com', ua, ZOTERO_CONFIG.CLIENT_NAME), ua);
|
2018-05-16 00:18:41 +00:00
|
|
|
});
|
|
|
|
|
2018-08-16 02:06:51 +00:00
|
|
|
it("should show Firefox user agent unchanged", function () {
|
2018-05-16 00:18:41 +00:00
|
|
|
var ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0';
|
2018-08-16 02:06:51 +00:00
|
|
|
assert.equal(Zotero.VersionHeader.update('example.com', ua, ZOTERO_CONFIG.CLIENT_NAME), ua);
|
2018-05-16 00:18:41 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-12-10 22:07:37 +00:00
|
|
|
});
|