Refactor merging of custom provider resources

This commit is contained in:
Philipp Muens 2016-08-14 20:52:06 +02:00
parent eb8546a1f6
commit 6513a1c6fe
2 changed files with 2 additions and 9 deletions

View File

@ -93,14 +93,7 @@ module.exports = {
// check if the user has added some "custom provider resources"
// and merge them into the CloudFormation template if there are any
_.forEach(this.serverless.service.resources, (resourceValue, resourceKey) => {
if (typeof resourceValue === 'string') {
coreCloudFormationTemplate[resourceKey] = resourceValue;
} else if (typeof resourceValue === 'object') {
_.merge(coreCloudFormationTemplate[resourceKey], resourceValue);
}
});
_.merge(coreCloudFormationTemplate, this.serverless.service.resources);
this.serverless.service.resources = coreCloudFormationTemplate;

View File

@ -214,7 +214,7 @@ describe('createStack', () => {
expect(awsDeploy.serverless.service.resources.Outputs.FakeOutput2)
.to.deep.equal(customResourcesMock.Outputs.FakeOutput2);
expect(awsDeploy.serverless.service.resources.CustomDefinition)
.to.deep.equal(customResourcesMock.Outputs.CustomDefinition);
.to.deep.equal(customResourcesMock.CustomDefinition);
awsDeploy.sdk.request.restore();
});