-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from MindscapeHQ/tags
Add setTags method
- Loading branch information
Showing
4 changed files
with
172 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,33 +6,63 @@ var Raygun = require('../lib/raygun.js'); | |
// need to get these working, they time out for some reason, despite the call succeeding | ||
|
||
test('send basic', {skip: true}, function (t) { | ||
t.plan(1); | ||
var client = new Raygun.Client().init({apiKey: process.env['RAYGUN_APIKEY']}); | ||
client.send(new Error(), {}, function (response) { | ||
t.equals(response.statusCode, 202); | ||
}); | ||
t.plan(1); | ||
var client = new Raygun.Client().init({apiKey: process.env['RAYGUN_APIKEY']}); | ||
client.send(new Error(), {}, function (response) { | ||
t.equals(response.statusCode, 202); | ||
}); | ||
}); | ||
|
||
test('send complex', {skip: true}, function (t) { | ||
t.plan(1); | ||
var client = new Raygun.Client().init({apiKey: process.env['RAYGUN_APIKEY']}).setUser("[email protected]").setVersion("1.0.0.0"); | ||
t.plan(1); | ||
var client = new Raygun.Client().init({apiKey: process.env['RAYGUN_APIKEY']}).setUser("[email protected]").setVersion("1.0.0.0"); | ||
|
||
client.send(new Error(), {}, function (response) { | ||
t.equals(response.statusCode, 202); | ||
}); | ||
client.send(new Error(), {}, function (response) { | ||
t.equals(response.statusCode, 202); | ||
}); | ||
}); | ||
|
||
test('send with OnBeforeSend', {skip: true}, function (t) { | ||
t.plan(1); | ||
var client = new Raygun.Client().init({apiKey: process.env['RAYGUN_APIKEY']}); | ||
|
||
var onBeforeSendCalled = false; | ||
client.onBeforeSend(function(payload){ | ||
return payload; | ||
}); | ||
|
||
client.send(new Error(), {}, function () { | ||
t.equals(onBeforeSendCalled, true); | ||
t.end(); | ||
}); | ||
t.plan(1); | ||
var client = new Raygun.Client().init({apiKey: process.env['RAYGUN_APIKEY']}); | ||
|
||
var onBeforeSendCalled = false; | ||
client.onBeforeSend(function (payload) { | ||
return payload; | ||
}); | ||
|
||
client.send(new Error(), {}, function () { | ||
t.equals(onBeforeSendCalled, true); | ||
t.end(); | ||
}); | ||
}); | ||
|
||
test('check that tags get passed through', {}, function (t) { | ||
var tag = ['Test']; | ||
var client = new Raygun.Client().init({apiKey: 'TEST'}); | ||
|
||
client.setTags(tag); | ||
|
||
client.onBeforeSend(function (payload) { | ||
t.same(payload.details.tags, tag); | ||
t.end(); | ||
}); | ||
|
||
client.send(new Error(), {}, function () { | ||
t.end(); | ||
}); | ||
}); | ||
|
||
test('check that tags get merged', {}, function (t) { | ||
var client = new Raygun.Client().init({apiKey: 'TEST'}); | ||
client.setTags(['Tag1']); | ||
|
||
client.onBeforeSend(function (payload) { | ||
t.same(payload.details.tags, ['Tag1', 'Tag2']); | ||
t.end(); | ||
}); | ||
|
||
client.send(new Error(), {}, function () { | ||
t.end(); | ||
}, null, ["Tag2"]); | ||
}); |