Skip to content

Commit

Permalink
use sinon.stub to supress warning output to console
Browse files Browse the repository at this point in the history
  • Loading branch information
Molly Lloyd committed Aug 15, 2016
1 parent 9534060 commit 9d238ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/js/data/symbol_bucket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ test('SymbolBucket', function(t) {

test('SymbolBucket integer overflow', function(t) {
var bucket = bucketSetup();
var spy = sinon.spy(util, 'warnOnce');
var numWarnings = 0;
sinon.stub(util, 'warnOnce', function(warning) {
if (warning.includes('Too many symbols being rendered in a tile.') || warning.includes('Too many glyphs being rendered in a tile.')) numWarnings++;
});

bucket.MAX_QUADS = 5;
bucket.populateArrays(collision, stacks);
t.ok(spy.calledTwice, 'warning is triggered when glyph and/or symbol quad exceeds MAX_QUADS');
t.equal(numWarnings, 2);
t.end();
});

0 comments on commit 9d238ce

Please sign in to comment.