2016-12-12 12:29:59 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
describe("Zotero.Proxies", function(){
|
|
|
|
describe("#getPotentialProxies", function() {
|
|
|
|
it("should return the provided url mapped to null when url is not proxied", function() {
|
2022-11-21 09:28:52 +00:00
|
|
|
let url = "http://www.example.com/";
|
2016-12-12 12:29:59 +00:00
|
|
|
let proxies = Zotero.Proxies.getPotentialProxies(url);
|
|
|
|
let expectedProxies = {};
|
|
|
|
expectedProxies[url] = null;
|
|
|
|
assert.deepEqual(proxies, expectedProxies);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should return the provided url and deproxied url", function() {
|
|
|
|
let url = "https://www.example.com.proxy.example.com";
|
|
|
|
let proxies = Zotero.Proxies.getPotentialProxies(url);
|
|
|
|
let expectedProxies = {};
|
|
|
|
expectedProxies[url] = null;
|
2022-11-10 10:46:14 +00:00
|
|
|
expectedProxies["https://www.example.com"] = {scheme: "https://%h.proxy.example.com/%p"};
|
2016-12-12 12:29:59 +00:00
|
|
|
assert.deepEqual(proxies, expectedProxies);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should return the provided url and deproxied url with replaced hyphens", function() {
|
|
|
|
let url = "https://www-example-com.proxy.example.com";
|
|
|
|
let proxies = Zotero.Proxies.getPotentialProxies(url);
|
|
|
|
let expectedProxies = {};
|
|
|
|
expectedProxies[url] = null;
|
2022-11-10 10:46:14 +00:00
|
|
|
expectedProxies["https://www.example.com"] = {scheme: "https://%h.proxy.example.com/%p"};
|
2016-12-12 12:29:59 +00:00
|
|
|
assert.deepEqual(proxies, expectedProxies);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|