Skip to content

Commit

Permalink
linting happy
Browse files Browse the repository at this point in the history
  • Loading branch information
horike37 committed Jan 8, 2017
1 parent 91631e8 commit ce1a44b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class ServerlessStepFunctions {
shortcut: 'd',
},
path: {
usage: 'The path to a json file with input data to be passed to the invoked step function',
usage:
'The path to a json file with input data to be passed to the invoked step function',
shortcut: 'p',
},
stage: {
Expand Down
18 changes: 7 additions & 11 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,33 +408,29 @@ describe('ServerlessStepFunctions', () => {
});

describe('#parseInputdate()', () => {
let fileExistsSyncStub;
let readFileSyncStub;
beforeEach(() => {
serverlessStepFunctions.serverless.config.servicePath = 'servicePath';
fileExistsSyncStub = sinon.stub(serverlessStepFunctions.serverless.utils, 'fileExistsSync')
.returns(true);
readFileSyncStub = sinon.stub(serverlessStepFunctions.serverless.utils, 'readFileSync')
sinon.stub(serverlessStepFunctions.serverless.utils, 'fileExistsSync').returns(true);
sinon.stub(serverlessStepFunctions.serverless.utils, 'readFileSync')
.returns({ foo: 'var' });
serverlessStepFunctions.options.data = null;
serverlessStepFunctions.options.path = 'data.json';
});

it('should throw error if file does not exists', () => {
serverlessStepFunctions.serverless.utils.fileExistsSync.restore();
fileExistsSyncStub = sinon.stub(serverlessStepFunctions.serverless.utils, 'fileExistsSync')
.returns(false);
sinon.stub(serverlessStepFunctions.serverless.utils, 'fileExistsSync').returns(false);
expect(() => serverlessStepFunctions.parseInputdate()).to.throw(Error);
serverlessStepFunctions.serverless.utils.readFileSync.restore();
});

it('should parse file if path param is provided', () => {
return serverlessStepFunctions.parseInputdate().then(() => {
it('should parse file if path param is provided'
, () => serverlessStepFunctions.parseInputdate().then(() => {
expect(serverlessStepFunctions.options.data).to.deep.equal('{"foo":"var"}');
serverlessStepFunctions.serverless.utils.fileExistsSync.restore();
serverlessStepFunctions.serverless.utils.readFileSync.restore();
});
});
})
);

it('should return resolve if path param is not provided', () => {
serverlessStepFunctions.options.path = null;
Expand Down

0 comments on commit ce1a44b

Please sign in to comment.