|
1 | 1 | 'use strict';
|
2 | 2 | const expect = require('chai').expect;
|
3 | 3 | const chalk = require('chalk');
|
| 4 | +const sinon = require('sinon'); |
4 | 5 | const streamTestUtils = require('../../utils/stream');
|
5 | 6 | const UI = require('../../../lib/ui');
|
6 | 7 |
|
@@ -45,6 +46,25 @@ describe('Unit: UI', function () {
|
45 | 46 | });
|
46 | 47 | });
|
47 | 48 |
|
| 49 | + describe('#logVerbose', function () { |
| 50 | + it('passes through options to log method when verbose is set', function () { |
| 51 | + let ui = new UI({verbose: true}); |
| 52 | + let logStub = sinon.stub(ui, 'log'); |
| 53 | + |
| 54 | + ui.logVerbose('foo', 'green', true); |
| 55 | + expect(logStub.calledOnce).to.be.true; |
| 56 | + expect(logStub.args[0]).to.deep.equal(['foo', 'green', true]); |
| 57 | + }); |
| 58 | + |
| 59 | + it('does not call log when verbose is false', function () { |
| 60 | + let ui = new UI({verbose: false}); |
| 61 | + let logStub = sinon.stub(ui, 'log'); |
| 62 | + |
| 63 | + ui.logVerbose('foo', 'green', false); |
| 64 | + expect(logStub.called).to.be.false; |
| 65 | + }); |
| 66 | + }); |
| 67 | + |
48 | 68 | it('#success outputs message with correct formatting', function (done) {
|
49 | 69 | let stdout, ui;
|
50 | 70 |
|
|
0 commit comments