Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-step-functions

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-step-functions - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

36

lib/yamlParser.js

@@ -17,26 +17,28 @@ 'use strict';

.then((serverlessFileParam) => {
this.serverless.service.stepFunctions = {};
this.serverless.service.stepFunctions.stateMachines
= serverlessFileParam.stepFunctions
&& serverlessFileParam.stepFunctions.stateMachines
? serverlessFileParam.stepFunctions.stateMachines : {};
this.serverless.service.stepFunctions.activities
= serverlessFileParam.stepFunctions
&& serverlessFileParam.stepFunctions.activities
? serverlessFileParam.stepFunctions.activities : [];
this.serverless.variables.populateObject(serverlessFileParam).then((parsedObject) => {
this.serverless.service.stepFunctions = {};
this.serverless.service.stepFunctions.stateMachines
= parsedObject.stepFunctions
&& parsedObject.stepFunctions.stateMachines
? parsedObject.stepFunctions.stateMachines : {};
this.serverless.service.stepFunctions.activities
= parsedObject.stepFunctions
&& parsedObject.stepFunctions.activities
? parsedObject.stepFunctions.activities : [];
if (!this.serverless.pluginManager.cliOptions.stage) {
this.serverless.pluginManager.cliOptions.stage = this.options.stage
if (!this.serverless.pluginManager.cliOptions.stage) {
this.serverless.pluginManager.cliOptions.stage = this.options.stage
|| (this.serverless.service.provider && this.serverless.service.provider.stage)
|| 'dev';
}
}
if (!this.serverless.pluginManager.cliOptions.region) {
this.serverless.pluginManager.cliOptions.region = this.options.region
if (!this.serverless.pluginManager.cliOptions.region) {
this.serverless.pluginManager.cliOptions.region = this.options.region
|| (this.serverless.service.provider && this.serverless.service.provider.region)
|| 'us-east-1';
}
}
this.serverless.variables.populateService(this.serverless.pluginManager.cliOptions);
return BbPromise.resolve();
this.serverless.variables.populateService(this.serverless.pluginManager.cliOptions);
return BbPromise.resolve();
});
});

@@ -43,0 +45,0 @@ },

@@ -25,5 +25,13 @@ 'use strict';

let populateServiceStub;
let yamlObjectParserStub;
beforeEach(() => {
populateServiceStub = sinon.stub(serverlessStepFunctions.serverless.variables,
'populateService').returns(BbPromise.resolve());
yamlObjectParserStub = sinon.stub(serverlessStepFunctions.serverless.variables,
'populateObject').returns(BbPromise.resolve({
stepFunctions: {
stateMachines: 'stepFunctions',
activities: 'my-activity',
},
}));
yamlParserStub = sinon.stub(serverlessStepFunctions.serverless.yamlParser, 'parse')

@@ -39,2 +47,8 @@ .returns(BbPromise.resolve({

afterEach(() => {
serverlessStepFunctions.serverless.yamlParser.parse.restore();
serverlessStepFunctions.serverless.variables.populateService.restore();
serverlessStepFunctions.serverless.variables.populateObject.restore();
});
it('should default to dev when stage and provider are not defined', () => {

@@ -79,6 +93,5 @@ serverlessStepFunctions.serverless.pluginManager.cliOptions.stage = null;

expect(yamlParserStub.calledOnce).to.be.equal(false);
expect(yamlObjectParserStub.calledOnce).to.be.equal(false);
expect(populateServiceStub.calledOnce).to.be.equal(false);
expect(serverless.service.stepFunctions).to.be.undefined; // eslint-disable-line
serverlessStepFunctions.serverless.yamlParser.parse.restore();
serverlessStepFunctions.serverless.variables.populateService.restore();
});

@@ -88,10 +101,17 @@ });

it('should create corresponding when stepfunctions param are given', () => {
serverlessStepFunctions.serverless.variables.populateObject.restore();
yamlObjectParserStub = sinon.stub(serverlessStepFunctions.serverless.variables,
'populateObject').returns(BbPromise.resolve({
stepFunctions: {
stateMachines: 'stepFunctions',
activities: 'my-activity',
},
}));
serverlessStepFunctions.yamlParse()
.then(() => {
expect(yamlParserStub.calledOnce).to.be.equal(true);
expect(yamlObjectParserStub.calledOnce).to.be.equal(true);
expect(populateServiceStub.calledOnce).to.be.equal(true);
expect(serverless.service.stepFunctions.stateMachines).to.be.equal('stepFunctions');
expect(serverless.service.stepFunctions.activities).to.be.equal('my-activity');
serverlessStepFunctions.serverless.yamlParser.parse.restore();
serverlessStepFunctions.serverless.variables.populateService.restore();
});

@@ -102,2 +122,3 @@ });

serverlessStepFunctions.serverless.yamlParser.parse.restore();
serverlessStepFunctions.serverless.variables.populateObject.restore();
yamlParserStub = sinon.stub(serverlessStepFunctions.serverless.yamlParser, 'parse')

@@ -107,10 +128,13 @@ .returns(BbPromise.resolve({

}));
yamlObjectParserStub = sinon.stub(serverless.variables,
'populateObject').returns(BbPromise.resolve({
stepFunctions: {},
}));
serverlessStepFunctions.yamlParse()
.then(() => {
expect(yamlParserStub.calledOnce).to.be.equal(true);
expect(yamlObjectParserStub.calledOnce).to.be.equal(true);
expect(populateServiceStub.calledOnce).to.be.equal(true);
expect(serverless.service.stepFunctions.stateMachines).to.be.deep.equal({});
expect(serverless.service.stepFunctions.activities).to.be.deep.equal([]);
serverlessStepFunctions.serverless.yamlParser.parse.restore();
serverlessStepFunctions.serverless.variables.populateService.restore();
});

@@ -117,0 +141,0 @@ });

{
"name": "serverless-step-functions",
"version": "1.4.0",
"version": "1.4.1",
"description": "The module is AWS Step Functions plugin for Serverless Framework",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc