|
1 | 1 | import * as mockery from 'mockery'; |
2 | 2 | import * as sinon from 'sinon'; |
3 | 3 | import { join } from 'path'; |
| 4 | +import chalk from 'chalk'; |
4 | 5 |
|
5 | 6 | const { describe, it, beforeEach, afterEach } = intern.getInterface('bdd'); |
6 | 7 | const { assert } = intern.getPlugin('chai'); |
@@ -97,6 +98,7 @@ describe('The main runner', () => { |
97 | 98 | const mkdirsSyncStub: sinon.SinonStub = sandbox.stub(); |
98 | 99 |
|
99 | 100 | const joinStub: sinon.SinonStub = sandbox.stub(); |
| 101 | + const loggingStub: sinon.SinonStub = sandbox.stub(); |
100 | 102 |
|
101 | 103 | joinStub.onCall(2).returns('theme-key-1'); |
102 | 104 | joinStub.onCall(3).returns('./widget/path/1'); |
@@ -126,6 +128,10 @@ describe('The main runner', () => { |
126 | 128 | basename: () => 'basename return string' |
127 | 129 | }); |
128 | 130 |
|
| 131 | + mockery.registerMock('./logging', { |
| 132 | + info: loggingStub |
| 133 | + }); |
| 134 | + |
129 | 135 | mockery.registerMock('fs-extra', { |
130 | 136 | existsSync: () => true, |
131 | 137 | writeFileSync: writeFileSyncStub, |
@@ -156,6 +162,10 @@ describe('The main runner', () => { |
156 | 162 | assert.equal(writeFileSyncStub.callCount, 2); |
157 | 163 | assert.deepEqual(writeFileSyncStub.firstCall.args, ['new/file/path-1', 'css file contents']); |
158 | 164 | assert.deepEqual(writeFileSyncStub.secondCall.args, ['new/file/path-2', 'css file contents']); |
| 165 | + |
| 166 | + assert.equal(loggingStub.callCount, 2); |
| 167 | + assert.deepEqual(loggingStub.firstCall.args, [chalk.green.bold(' create ') + 'new/file/path-1']); |
| 168 | + assert.deepEqual(loggingStub.secondCall.args, [chalk.green.bold(' create ') + 'new/file/path-2']); |
159 | 169 | }); |
160 | 170 |
|
161 | 171 | it('Creates a theme file', async () => { |
|
0 commit comments