Skip to content

Commit

Permalink
Experiment with test structuring
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickreimer committed Oct 3, 2019
1 parent 89e4267 commit ef65a75
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
10 changes: 2 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
const argv = require('yargs');
const deploy = require('./cmds/deploy');

argv
.scriptName('statickit')
.usage('$0 <command> [options]')
.command(deploy)
.help().argv;
const parser = require('./parser');
parser.argv;
7 changes: 7 additions & 0 deletions src/parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const parser = require('yargs');

module.exports = parser
.scriptName('statickit')
.usage('$0 <command> [options]')
.command(require('./cmds/deploy'))
.help();
12 changes: 10 additions & 2 deletions test/deploy.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
test('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
const parser = require('../src/parser');

it('returns help output', async () => {
const output = await new Promise(resolve => {
parser.parse('--help', (err, argv, output) => {
resolve(output);
});
});

expect(output).toMatch(/Performs a deployment/);
});

0 comments on commit ef65a75

Please sign in to comment.