fix tests for invoke lcal env vars fix

This commit is contained in:
Daniel Schep 2018-12-05 11:21:42 -05:00
parent 44a6ac1a10
commit 7a1f4ece8e

View File

@ -44,23 +44,31 @@ describe('AwsInvokeLocal', () => {
it('should set the provider variable to an instance of AwsProvider', () =>
expect(awsInvokeLocal.provider).to.be.instanceof(AwsProvider));
it('should run promise chain in order', () => {
const validateStub = sinon
.stub(awsInvokeLocal, 'extendedValidate').resolves();
const loadEnvVarsStub = sinon
.stub(awsInvokeLocal, 'loadEnvVars').resolves();
it('should run invoke:local:invoke promise chain in order', () => {
const invokeLocalStub = sinon
.stub(awsInvokeLocal, 'invokeLocal').resolves();
return awsInvokeLocal.hooks['invoke:local:invoke']().then(() => {
expect(validateStub.calledOnce).to.be.equal(true);
expect(invokeLocalStub.callCount).to.be.equal(1);
awsInvokeLocal.invokeLocal.restore();
});
});
it('should run before:invoke:local:loadEnvVars promise chain in order', () => {
const validateStub = sinon
.stub(awsInvokeLocal, 'extendedValidate').resolves();
const loadEnvVarsStub = sinon
.stub(awsInvokeLocal, 'loadEnvVars').resolves();
return awsInvokeLocal.hooks['before:invoke:local:loadEnvVars']().then(() => {
expect(validateStub.callCount).to.be.equal(1);
expect(loadEnvVarsStub.calledAfter(validateStub)).to.be.equal(true);
expect(invokeLocalStub.calledAfter(loadEnvVarsStub)).to.be.equal(true);
awsInvokeLocal.extendedValidate.restore();
awsInvokeLocal.loadEnvVars.restore();
awsInvokeLocal.invokeLocal.restore();
});
});