This repository has been archived by the owner on Jan 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
cctrayUrlSpec.js
63 lines (55 loc) · 2.45 KB
/
cctrayUrlSpec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* eXtreme Feedback Device (XFD) is a Build Radiator for Continuous
* Integration servers. Copyright (C) 2010-2012 The Build Doctor Limited.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
describe('cctray', function () {
var config;
beforeEach(function () {
config = CONFIG;
config.engine = null;
config.init();
});
it('should have a default url', function() {
expect(CCTray.url(config)).toEqual('http://localhost:6969/localhost:8888/hudson?jsonp=?');
});
it('should have a url with a different context root if you tell it', function() {
config.context="/harry";
expect(CCTray.url(config)).toEqual('http://localhost:6969/localhost:8888/harry?jsonp=?');
});
it('should cope with chrome passing a trailing hash on the context', function() {
config.context="/ci#";
expect(CCTray.url(config)).toEqual('http://localhost:6969/localhost:8888/ci?jsonp=?');
});
it('should cope with chrome passing escaped paths hash on the context', function() {
config.context="%2Fhudson";
expect(CCTray.url(config)).toEqual('http://localhost:6969/localhost:8888/hudson?jsonp=?');
});
it('should have a url with a different port root if you tell it', function() {
config.port="8080";
expect(CCTray.url(config)).toEqual('http://localhost:6969/localhost:8080/hudson?jsonp=?');
});
it('should have a url with a different host if you tell it', function() {
fakeLookup = function (param) {
if ("engine" === param) { return "cctray"; }
else if ("host" === param) { return "mygreatserver"; }
else if ("context" === param) { return "/go/cctray.xml"; }
else if ("port" === param) { return 80; }
};
spyOn(config, 'lookupParam').andCallFake(fakeLookup);
config.init();
expect(CCTray.url(config)).toEqual('http://localhost:6969/mygreatserver:80/go/cctray.xml?jsonp=?');
});
});