Skip to content

Commit

Permalink
Update test, setup travis
Browse files Browse the repository at this point in the history
  • Loading branch information
mklabs committed Sep 29, 2018
1 parent cff47b0 commit ee72e69
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
@@ -0,0 +1,3 @@
language: node_js
node_js:
- "node"
5 changes: 3 additions & 2 deletions 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)**

Expand Down Expand Up @@ -104,6 +103,8 @@ describe('Testing on a wtf thing', function() {

promise example



### API

#### module.exports = Runnable;
Expand Down
6 changes: 2 additions & 4 deletions test/ava/cli.js
Expand Up @@ -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');
});
24 changes: 22 additions & 2 deletions 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('../..');
Expand All @@ -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');
});
});

0 comments on commit ee72e69

Please sign in to comment.