Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint and style patches #7004

Merged
merged 2 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/classes/PluginManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('PluginManager', () => {
}

functions() {
this.deployedFunctions = this.deployedFunctions + 1;
this.deployedFunctions += 1;
}
}

Expand All @@ -88,7 +88,7 @@ describe('PluginManager', () => {
}

functions() {
this.deployedFunctions = this.deployedFunctions + 1;
this.deployedFunctions += 1;
}
}

Expand Down Expand Up @@ -135,14 +135,14 @@ describe('PluginManager', () => {

functions() {
return new BbPromise(resolve => {
this.deployedFunctions = this.deployedFunctions + 1;
this.deployedFunctions += 1;
return resolve();
});
}

resources() {
return new BbPromise(resolve => {
this.deployedResources = this.deployedResources + 1;
this.deployedResources += 1;
return resolve();
});
}
Expand Down Expand Up @@ -190,11 +190,11 @@ describe('PluginManager', () => {
}

functions() {
this.deployedFunctions = this.deployedFunctions + 1;
this.deployedFunctions += 1;
}

resources() {
this.deployedResources = this.deployedResources + 1;
this.deployedResources += 1;
}
}

Expand Down Expand Up @@ -241,11 +241,11 @@ describe('PluginManager', () => {
}

functions() {
this.deployedFunctions = this.deployedFunctions + 1;
this.deployedFunctions += 1;
}

resources() {
this.deployedResources = this.deployedResources + 1;
this.deployedResources += 1;
}
}

Expand Down
39 changes: 20 additions & 19 deletions lib/plugins/aws/deploy/lib/existsDeploymentBucket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,25 @@ describe('#existsDeploymentBucket()', () => {
});
});

[{ region: 'eu-west-1', response: 'EU' }, { region: 'us-east-1', response: '' }].forEach(
value => {
it(`should handle inconsistent getBucketLocation responses for ${value.region} region`, () => {
const bucketName = 'com.serverless.deploys';

awsPlugin.provider.options.region = value.region;

sinon.stub(awsPlugin.provider, 'request').resolves({
LocationConstraint: value.response,
});

awsPlugin.serverless.service.provider.deploymentBucket = bucketName;
return expect(awsPlugin.existsDeploymentBucket(bucketName)).to.be.fulfilled.then(() => {
expect(awsPluginStub.args[0][0]).to.equal('S3');
expect(awsPluginStub.args[0][1]).to.equal('getBucketLocation');
expect(awsPluginStub.args[0][2].Bucket).to.equal(bucketName);
});
[
{ region: 'eu-west-1', response: 'EU' },
{ region: 'us-east-1', response: '' },
].forEach(value => {
it(`should handle inconsistent getBucketLocation responses for ${value.region} region`, () => {
const bucketName = 'com.serverless.deploys';

awsPlugin.provider.options.region = value.region;

sinon.stub(awsPlugin.provider, 'request').resolves({
LocationConstraint: value.response,
});

awsPlugin.serverless.service.provider.deploymentBucket = bucketName;
return expect(awsPlugin.existsDeploymentBucket(bucketName)).to.be.fulfilled.then(() => {
expect(awsPluginStub.args[0][0]).to.equal('S3');
expect(awsPluginStub.args[0][1]).to.equal('getBucketLocation');
expect(awsPluginStub.args[0][2].Bucket).to.equal(bucketName);
});
}
);
});
});
});
5 changes: 4 additions & 1 deletion lib/plugins/aws/package/lib/generateCoreTemplate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ describe('#generateCoreTemplate()', () => {
},
],
},
Tags: [{ Key: 'FOO', Value: 'bar' }, { Key: 'BAZ', Value: 'qux' }],
Tags: [
{ Key: 'FOO', Value: 'bar' },
{ Key: 'BAZ', Value: 'qux' },
],
},
});
}));
Expand Down
8 changes: 5 additions & 3 deletions lib/plugins/aws/package/lib/mergeIamTemplates.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,11 @@ module.exports = {
violationsFound = 'it is not an array';
} else {
const descriptions = statements.map((statement, i) => {
const missing = [['Effect'], ['Action', 'NotAction'], ['Resource', 'NotResource']].filter(
props => props.every(prop => statement[prop] === undefined)
);
const missing = [
['Effect'],
['Action', 'NotAction'],
['Resource', 'NotResource'],
].filter(props => props.every(prop => statement[prop] === undefined));
return missing.length === 0
? null
: `statement ${i} is missing the following properties: ${missing
Expand Down
18 changes: 9 additions & 9 deletions lib/plugins/package/lib/packageService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,9 @@ describe('#packageService()', () => {
};
serverless.config.servicePath = servicePath;

return expect(packagePlugin.resolveFilePathsFromPatterns(params)).to.be.fulfilled.then(
actual => expect(actual).to.deep.equal([handlerFile])
);
return expect(
packagePlugin.resolveFilePathsFromPatterns(params)
).to.be.fulfilled.then(actual => expect(actual).to.deep.equal([handlerFile]));
});

it('should include file specified with `!` in exclude params', () => {
Expand All @@ -639,9 +639,9 @@ describe('#packageService()', () => {
};
serverless.config.servicePath = servicePath;

return expect(packagePlugin.resolveFilePathsFromPatterns(params)).to.be.fulfilled.then(
actual => expect(actual).to.deep.equal([handlerFile, utilsFile])
);
return expect(
packagePlugin.resolveFilePathsFromPatterns(params)
).to.be.fulfilled.then(actual => expect(actual).to.deep.equal([handlerFile, utilsFile]));
});

it('should exclude file specified with `!` in include params', () => {
Expand All @@ -652,9 +652,9 @@ describe('#packageService()', () => {
const expected = [handlerFile];
serverless.config.servicePath = servicePath;

return expect(packagePlugin.resolveFilePathsFromPatterns(params)).to.be.fulfilled.then(
actual => expect(actual).to.deep.equal(expected)
);
return expect(
packagePlugin.resolveFilePathsFromPatterns(params)
).to.be.fulfilled.then(actual => expect(actual).to.deep.equal(expected));
});
});
});