diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2197832 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "node" diff --git a/readme.md b/readme.md index 703bfa5..2ce5f5d 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,4 @@ -gentle-cli -========== +# gentle-cli [![Build Status](https://travis-ci.org/mklabs/gentle-cli.svg?branch=master)](https://travis-ci.org/mklabs/gentle-cli) **Inspired / Based off both [cli-easy](https://github.com/flatiron/cli-easy) and [supertest](https://github.com/visionmedia/supertest)** @@ -104,6 +103,8 @@ describe('Testing on a wtf thing', function() { promise example + + ### API #### module.exports = Runnable; diff --git a/test/ava/cli.js b/test/ava/cli.js index be83d5f..23aaebf 100644 --- a/test/ava/cli.js +++ b/test/ava/cli.js @@ -45,13 +45,11 @@ test('Testing promise style catch', t => { }); test('Testing promise style async', async t => { - t.plan(1); - const result = await cli() .use('echo foo') .expect(0) .end(); - console.log('result', result); - + t.is(result.status, 0); + t.is(result.text, 'foo\n'); }); diff --git a/test/mocha/cli.js b/test/mocha/cli.js index dd55839..bf14868 100644 --- a/test/mocha/cli.js +++ b/test/mocha/cli.js @@ -1,4 +1,3 @@ -const constants = require('constants'); const assert = require('assert'); const debug = require('debug')('gentle-cli:test'); const cli = require('../..'); @@ -15,8 +14,29 @@ describe('gentle-cli', () => { }); }); - it('Testing on uname', () => cli() + it('Testing on uname', () => + cli() .use('uname') .expect(0, process.platform === 'darwin' ? 'Darwin' : 'Linux') .end()); + + it('Testing promise style', () => + cli() + .use('ls scripts') + .expect(0) + .then(res => { + assert.equal(res.status, 0); + assert.equal(res.text, 'docs.js\n', 'Expected return text'); + })); + + it('Testing promise async style', async () => { + const res = await cli() + .use('ls scripts') + .expect(0) + .end(); + + console.log('res', res); + assert.equal(res.status, 0); + assert.equal(res.text, 'docs.js\n', 'Expected return text'); + }); });