mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
fix tests for invoke lcal env vars fix
This commit is contained in:
parent
44a6ac1a10
commit
7a1f4ece8e
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user