Skip to content

Commit 5962dc0

Browse files
committed
Fix tests
1 parent c615f5d commit 5962dc0

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/raven.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ function send(data) {
614614
// Send along an event_id if not explicitly passed.
615615
// This event_id can be used to reference the error within Sentry itself.
616616
// Set lastEventId after we know the error should actually be sent
617-
lastEventId = data.event_id || (data.event_id = generateUUID4());
617+
lastEventId = data.event_id || (data.event_id = uuid4());
618618

619619
makeRequest(data);
620620
}
@@ -673,16 +673,19 @@ function joinRegExp(patterns) {
673673
}
674674

675675
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
676-
function generateUUID4() {
676+
function uuid4() {
677677
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
678678
var r = Math.random()*16|0,
679679
v = c == 'x' ? r : (r&0x3|0x8);
680680
return v.toString(16);
681681
});
682682
}
683683

684-
// Attempt to initialize Raven on load
685-
var RavenConfig = window.RavenConfig;
686-
if (RavenConfig) {
687-
Raven.config(RavenConfig.dsn, RavenConfig.config).install();
684+
function afterLoad() {
685+
// Attempt to initialize Raven on load
686+
var RavenConfig = window.RavenConfig;
687+
if (RavenConfig) {
688+
Raven.config(RavenConfig.dsn, RavenConfig.config).install();
689+
}
688690
}
691+
afterLoad();

test/raven.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function setupRaven() {
3636
}
3737

3838
// patched to return a predictable result
39-
function generateUUID4() {
39+
function uuid4() {
4040
return 'abc123';
4141
}
4242

@@ -998,7 +998,7 @@ describe('Raven (public API)', function() {
998998
this.sinon.stub(window, 'isSetup').returns(false);
999999
this.sinon.stub(TraceKit.report, 'subscribe');
10001000

1001-
Raven.afterLoad();
1001+
afterLoad();
10021002

10031003
assert.equal(globalKey, 'random');
10041004
assert.equal(globalServer, 'http://some.other.server:80/api/2/store/');

0 commit comments

Comments
 (0)