Skip to content

Commit 95a265a

Browse files
committed
Add tests for logDebug
1 parent 02c3301 commit 95a265a

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

test/raven.test.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,31 +218,32 @@ describe('globals', function() {
218218
it('should return false when Raven is not configured', function() {
219219
hasJSON = true; // be explicit
220220
globalServer = undefined;
221-
this.sinon.stub(console, 'error');
221+
this.sinon.stub(window, 'logDebug');
222222
assert.isFalse(isSetup());
223223
});
224224

225-
it('should not write to console.error when Raven is not configured and Raven.debug is false', function() {
226-
hasJSON = true; // be explicit
227-
globalServer = undefined;
228-
Raven.debug = false;
229-
this.sinon.stub(console, 'error');
230-
isSetup();
231-
assert.isFalse(console.error.calledOnce);
225+
it('should return true when everything is all gravy', function() {
226+
hasJSON = true;
227+
assert.isTrue(isSetup());
232228
});
229+
});
233230

234-
it('should write to console.error when Raven is not configured and Raven.debug is true', function() {
235-
hasJSON = true; // be explicit
236-
globalServer = undefined;
237-
Raven.debug = true;
238-
this.sinon.stub(console, 'error');
239-
isSetup();
240-
assert.isTrue(console.error.calledOnce);
231+
describe('logDebug', function() {
232+
var level = 'error',
233+
message = 'foobar';
234+
235+
it('should not write to console when Raven.debug is false', function() {
236+
Raven.debug = false;
237+
this.sinon.stub(console, level);
238+
logDebug(level, message);
239+
assert.isFalse(console[level].called);
241240
});
242241

243-
it('should return true when everything is all gravy', function() {
244-
hasJSON = true;
245-
assert.isTrue(isSetup());
242+
it('should write to console when Raven.debug is true', function() {
243+
Raven.debug = true;
244+
this.sinon.stub(console, level);
245+
logDebug(level, message);
246+
assert.isTrue(console[level].calledOnce);
246247
});
247248
});
248249

0 commit comments

Comments
 (0)