Repository navigation
Expand file tree
/
Copy pathutils.js
More file actions
81 lines (59 loc) · 2.66 KB
/
Copy pathutils.js
File metadata and controls
81 lines (59 loc) · 2.66 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
$(document).ready(function() {
module("Raven.config");
test("should parse dsn as only argument", function() {
// TODO: this test isnt isolated
var dsn = "http://public:secret@example.com:80/project-id";
Raven.config(dsn);
var config = Raven.options;
equal(config['publicKey'], 'public');
equal(config['secretKey'], 'secret');
equal(config['servers'][0], 'http://example.com:80/api/store/');
equal(config['projectId'], 'project-id');
});
module("Raven.parseHeaders");
test("should parse headers into an object", function() {
var hstring = "Date: Mon, 06 Feb 2012 17:25:42 GMT\n"
hstring += "Server: WSGIServer/0.1 Python/2.7.2\n"
hstring += "Vary: Cookie\n"
hstring += "Content-Type: text/html; charset=utf-8\n"
var headers = Raven.parseHeaders(hstring);
equal(headers['Date'], "Mon, 06 Feb 2012 17:25:42 GMT");
equal(headers['Server'], "WSGIServer/0.1 Python/2.7.2");
equal(headers['Vary'], "Cookie");
equal(headers['Content-Type'], "text/html; charset=utf-8");
});
module("Raven.trimString");
test("should trim leading space", function() {
var result = Raven.trimString(' foo');
equal(result, 'foo');
});
test("should trim trailing space", function() {
var result = Raven.trimString('foo ');
equal(result, 'foo');
});
module("Raven.parseDSN");
test("should parse dsn into an object", function() {
var dsn = "http://public:secret@example.com:80/project-id";
var config = Raven.parseDSN(dsn);
equal(config['publicKey'], 'public');
equal(config['secretKey'], 'secret');
equal(config['servers'][0], 'http://example.com:80/api/store/');
equal(config['projectId'], 'project-id');
});
test("should parse dsn with a path", function() {
var dsn = "http://public:secret@example.com:80/path/project-id";
var config = Raven.parseDSN(dsn);
equal(config['publicKey'], 'public');
equal(config['secretKey'], 'secret');
equal(config['servers'][0], 'http://example.com:80/path/api/store/');
equal(config['projectId'], 'project-id');
});
test("should parse dsn without a secret key", function() {
var dsn = "http://public@example.com:80/path/project-id";
var config = Raven.parseDSN(dsn);
equal(config['publicKey'], 'public');
equal(config['secretKey'], '');
equal(config['servers'][0], 'http://example.com:80/path/api/store/');
equal(config['projectId'], 'project-id');
});
});