Skip to content

Commit

Permalink
test(logging): improve _log with single parameter with sinon.spy
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD authored Jan 15, 2018
1 parent fe48dfa commit 9891f31
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/unit/logging.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,16 @@
suite('_logger', () => {
test('_log with single parameter', () => {
const msg = 'log test';
const logHistory = [];
const orgConsole = console;
const spy = sinon.spy();
window.console = {
log: msg => {
logHistory.push(msg);
}
log: spy
};
Polymer.Base._log(msg);
window.console = orgConsole;
assert.equal(logHistory[0], msg);
assert.equal(logHistory.length, 1, 'console.log called more than one time');
assert.equal(spy.callCount, 1, 'console.log called more than one time');
assert.equal(spy.args[0].length, 1, 'console.log called with more than one argument');
assert.equal(spy.args[0][0], msg, 'message not pass properly to log');
});
});
</script>
Expand Down

0 comments on commit 9891f31

Please sign in to comment.