Skip to content

Commit

Permalink
updated command line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
kanekotic committed Jul 2, 2018
1 parent 0c702d9 commit 1bd85d0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 35 deletions.
24 changes: 0 additions & 24 deletions bin/gatoes.js

This file was deleted.

17 changes: 17 additions & 0 deletions bin/gatoo.js
@@ -0,0 +1,17 @@
#! /usr/bin/env node

const program = require('commander'),
index = require('../lib/index'),
packageJson = require('../package.json')

program
.version(packageJson.version)

program
.command('console')
.description('get data to console from google analytics')
.action(() =>
console.log("TODO")
)

program.parse(process.argv)
16 changes: 5 additions & 11 deletions test/bin/gatoes-test.js → test/bin/gatoo-test.js
Expand Up @@ -21,8 +21,7 @@ jest.mock('../../lib/index', () => {
return "OK"
}
return {
realtime: jest.fn().mockImplementation(impFun),
batch: jest.fn().mockImplementation(impFun)
importer: jest.fn().mockImplementation(impFun),
}
})

Expand All @@ -34,7 +33,7 @@ jest.mock('../../package.json', () => {
})

const commander = require('commander'),
gatoes = require('../../bin/gatoes'),
gatoo = require('../../bin/gatoo'),
index = require('../../lib/index'),
packageJson = require('../../package.json')

Expand All @@ -43,15 +42,10 @@ describe('command line', () => {
expect(commander.version.mock.calls[0][0]).toBe(packageJson.version)
})

it("is has command to convert in realtime with correct description", () => {
expect(commander.command.mock.calls[0][0]).toBe("realtime")
expect(commander.description.mock.calls[0][0]).toBe("realtime updates")
it("is has command to convert in consol with correct description", () => {
expect(commander.command.mock.calls[0][0]).toBe("console")
expect(commander.description.mock.calls[0][0]).toBe("get data to console from google analytics")
expect(commander.action.mock.calls[0][0]).toBeInstanceOf(Function)
})

it("is has command to convert in batch with correct description", () => {
expect(commander.command.mock.calls[1][0]).toBe("batch")
expect(commander.description.mock.calls[1][0]).toBe("batch updates")
expect(commander.action.mock.calls[1][0]).toBeInstanceOf(Function)
})
})

0 comments on commit 1bd85d0

Please sign in to comment.