1 | var common = require('./common');
|
2 | var airbrake = require(common.dir.root).createClient(common.projectId, common.key);
|
3 | var assert = require('assert');
|
4 | var os = require('os');
|
5 |
|
6 | (function testDefaultHost() {
|
7 | assert.equal(airbrake.host, 'https://' + os.hostname());
|
8 | }());
|
9 |
|
10 | (function testPlainHost() {
|
11 | var err = new Error('oh no');
|
12 | var url = airbrake.contextJSON(err).url;
|
13 | assert.equal(url, airbrake.host.toLowerCase() + '/');
|
14 | }());
|
15 |
|
16 | (function testPartialErrUrl() {
|
17 | var err = new Error('oh no');
|
18 | err.url = '/foo';
|
19 | var url = airbrake.contextJSON(err).url;
|
20 |
|
21 | assert.equal(url, airbrake.host.toLowerCase() + err.url);
|
22 | }());
|
23 |
|
24 | (function testAbsoluteErrUrl() {
|
25 | var err = new Error('oh no');
|
26 | err.url = 'http://example.org/bar';
|
27 | var url = airbrake.contextJSON(err).url;
|
28 |
|
29 | assert.equal(url, err.url);
|
30 | }());
|