Skip to content
This repository was archived by the owner on Feb 27, 2019. It is now read-only.

Commit a3cb4dd

Browse files
committed
Add tests
1 parent 4f0e2cd commit a3cb4dd

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/app/index.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const chai = require('chai');
2+
const spies = require('chai-spies');
3+
const expect = chai.expect;
4+
const should = chai.should(); // eslint-disable-line no-unused-vars
5+
chai.use(spies);
6+
const test = require('ava');
7+
const TestUtils = require('fountain-generator').TestUtils;
8+
9+
let context;
10+
11+
test.before(() => {
12+
context = TestUtils.mock('app');
13+
require('../../generators/app/index');
14+
process.chdir('../../');
15+
});
16+
17+
test(`Call this.log when 'skip-welcome-message' is undefined`, () => {
18+
context.log = () => {};
19+
const spy = chai.spy.on(context, 'log');
20+
TestUtils.call(context, 'initializing');
21+
expect(spy).to.have.been.called.twice();
22+
});
23+
24+
test(`Not call this.log when 'skip-welcome-message' is true`, () => {
25+
context.log = () => {};
26+
const spy = chai.spy.on(context, 'log');
27+
TestUtils.call(context, 'initializing', {'skip-welcome-message': true});
28+
spy.should.have.not.been.called();
29+
});
30+
31+
test('Call this.fountainPrompting', () => {
32+
context.fountainPrompting = () => {};
33+
const spy = chai.spy.on(context, 'fountainPrompting');
34+
TestUtils.call(context, 'prompting');
35+
expect(spy).to.have.been.called.once();
36+
});
37+
38+
test('composing(): Call this.composeWith', () => {
39+
context.composeWith = () => {};
40+
const spy = chai.spy.on(context, 'composeWith');
41+
TestUtils.call(context, 'composing', {framework: 'react'});
42+
expect(spy).to.have.been.called.with('fountain-react');
43+
});

0 commit comments

Comments
 (0)