Skip to content

Commit 040089a

Browse files
committed
chore: prettify cucumber tests (aws#706)
1 parent 6988308 commit 040089a

File tree

73 files changed

+2006
-1252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2006
-1252
lines changed

features/acm/step_definitions/acm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var { ACM } = require('../../../clients/node/client-acm-node');
1+
var { ACM } = require("../../../clients/node/client-acm-node");
22

33
module.exports = function() {
4-
this.Before("@acm", function (callback) {
4+
this.Before("@acm", function(callback) {
55
this.service = new ACM({});
66
callback();
77
});

features/apigateway/step_definitions/apigateway.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = function() {
2-
this.Before("@apigateway", function (callback) {
2+
this.Before("@apigateway", function(callback) {
33
this.service = new this.AWS.APIGateway();
44
callback();
55
});
Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,44 @@
1-
var { AutoScaling } = require('../../../clients/node/client-auto-scaling-node');
1+
var { AutoScaling } = require("../../../clients/node/client-auto-scaling-node");
22

33
module.exports = function() {
4-
this.Before('@autoscaling', function (callback) {
5-
this.service = new AutoScaling({region: 'us-east-1'});
4+
this.Before("@autoscaling", function(callback) {
5+
this.service = new AutoScaling({ region: "us-east-1" });
66
callback();
77
});
88

9-
this.Given(/^I create a launch configuration with name "([^"]*)"$/, function(name, callback) {
9+
this.Given(/^I create a launch configuration with name "([^"]*)"$/, function(
10+
name,
11+
callback
12+
) {
1013
var params = {
11-
ImageId: 'ami-1624987f',
12-
InstanceType: 'm1.small',
14+
ImageId: "ami-1624987f",
15+
InstanceType: "m1.small",
1316
LaunchConfigurationName: name
1417
};
15-
this.request(null, 'createLaunchConfiguration', params, callback, false);
18+
this.request(null, "createLaunchConfiguration", params, callback, false);
1619
});
1720

1821
this.Given(/^I describe launch configurations$/, function(callback) {
19-
this.request(null, 'describeLaunchConfigurations', {}, callback);
22+
this.request(null, "describeLaunchConfigurations", {}, callback);
2023
});
2124

22-
this.Then(/^the list should contain the launch configuration "([^"]*)"$/, function(name, callback) {
23-
this.assert.contains(this.data.LaunchConfigurations, function(configuration) {
24-
return configuration.LaunchConfigurationName === name;
25-
});
26-
callback();
27-
});
25+
this.Then(
26+
/^the list should contain the launch configuration "([^"]*)"$/,
27+
function(name, callback) {
28+
this.assert.contains(this.data.LaunchConfigurations, function(
29+
configuration
30+
) {
31+
return configuration.LaunchConfigurationName === name;
32+
});
33+
callback();
34+
}
35+
);
2836

29-
this.Then(/^I delete the launch configuration "([^"]*)"$/, function(name, callback) {
30-
var params = {LaunchConfigurationName: name};
31-
this.request(null, 'deleteLaunchConfiguration', params, callback);
37+
this.Then(/^I delete the launch configuration "([^"]*)"$/, function(
38+
name,
39+
callback
40+
) {
41+
var params = { LaunchConfigurationName: name };
42+
this.request(null, "deleteLaunchConfiguration", params, callback);
3243
});
3344
};
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
var { CloudFormation } = require('../../../clients/node/client-cloudformation-node');
1+
var {
2+
CloudFormation
3+
} = require("../../../clients/node/client-cloudformation-node");
24

35
module.exports = function() {
4-
this.Before("@cloudformation", function (callback) {
6+
this.Before("@cloudformation", function(callback) {
57
this.service = new CloudFormation({});
68
callback();
79
});
810

9-
this.Given(/^I create a CloudFormation stack with name prefix "([^"]*)"$/, function(prefix, callback) {
10-
this.stackName = this.uniqueName(prefix);
11-
this.templateBody = '{"Resources":{"member":{"Type":"AWS::SQS::Queue"}}}';
12-
var params = { TemplateBody: this.templateBody, StackName: this.stackName };
13-
this.request(null, 'createStack', params, callback, false);
14-
});
11+
this.Given(
12+
/^I create a CloudFormation stack with name prefix "([^"]*)"$/,
13+
function(prefix, callback) {
14+
this.stackName = this.uniqueName(prefix);
15+
this.templateBody = '{"Resources":{"member":{"Type":"AWS::SQS::Queue"}}}';
16+
var params = {
17+
TemplateBody: this.templateBody,
18+
StackName: this.stackName
19+
};
20+
this.request(null, "createStack", params, callback, false);
21+
}
22+
);
1523
};

features/cloudfront/step_definitions/cloudfront-latest.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,54 @@
11
module.exports = function() {
22
var createParams = {
3-
CallerReference: '',
3+
CallerReference: "",
44
Aliases: {
55
Quantity: 0
66
},
7-
DefaultRootObject: '',
7+
DefaultRootObject: "",
88
Origins: {
9-
Items: [{
10-
Id: 'origin',
11-
DomainName: 'example.com',
12-
CustomOriginConfig: {
13-
HTTPPort: 80,
14-
HTTPSPort: 443,
15-
OriginProtocolPolicy: 'match-viewer'
9+
Items: [
10+
{
11+
Id: "origin",
12+
DomainName: "example.com",
13+
CustomOriginConfig: {
14+
HTTPPort: 80,
15+
HTTPSPort: 443,
16+
OriginProtocolPolicy: "match-viewer"
17+
}
1618
}
17-
}],
19+
],
1820
Quantity: 1
1921
},
2022
DefaultCacheBehavior: {
21-
TargetOriginId: 'origin',
23+
TargetOriginId: "origin",
2224
ForwardedValues: {
2325
QueryString: false,
24-
Cookies: { Forward: 'all' }
26+
Cookies: { Forward: "all" }
2527
},
2628
TrustedSigners: {
2729
Items: [],
2830
Enabled: false,
2931
Quantity: 0
3032
},
31-
ViewerProtocolPolicy: 'allow-all',
33+
ViewerProtocolPolicy: "allow-all",
3234
MinTTL: 0
3335
},
3436
CacheBehaviors: {
3537
Items: [],
3638
Quantity: 0
3739
},
38-
Comment: '',
40+
Comment: "",
3941
Logging: {
4042
Enabled: false,
41-
Bucket: 'invalidbucket.s3.amazonaws.com',
42-
Prefix: 'prefix',
43+
Bucket: "invalidbucket.s3.amazonaws.com",
44+
Prefix: "prefix",
4345
IncludeCookies: false
4446
},
45-
PriceClass: 'PriceClass_All',
47+
PriceClass: "PriceClass_All",
4648
Enabled: false
4749
};
4850

49-
this.Before("@cloudfront", function (callback) {
51+
this.Before("@cloudfront", function(callback) {
5052
this.service = new this.AWS.CloudFront();
5153
this.cfCreateParams = createParams;
5254
callback();
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
module.exports = function() {
2-
this.Given(/^I create a CloudFront distribution with name prefix "([^"]*)"$/, function(prefix, callback) {
3-
this.cfName = this.uniqueName(prefix);
4-
this.cfCreateParams.CallerReference = this.cfName;
5-
this.cfCreateParams.Origins.Items[0].Id = (this.cfName === '' ? 'origin' : 'InvalidOrigin');
6-
this.request(null, 'createDistribution', { DistributionConfig: this.cfCreateParams }, callback, false);
7-
});
2+
this.Given(
3+
/^I create a CloudFront distribution with name prefix "([^"]*)"$/,
4+
function(prefix, callback) {
5+
this.cfName = this.uniqueName(prefix);
6+
this.cfCreateParams.CallerReference = this.cfName;
7+
this.cfCreateParams.Origins.Items[0].Id =
8+
this.cfName === "" ? "origin" : "InvalidOrigin";
9+
this.request(
10+
null,
11+
"createDistribution",
12+
{ DistributionConfig: this.cfCreateParams },
13+
callback,
14+
false
15+
);
16+
}
17+
);
818

919
this.Given(/^I list CloudFront distributions$/, function(callback) {
10-
this.request(null, 'listDistributions', {}, callback);
20+
this.request(null, "listDistributions", {}, callback);
1121
});
12-
1322
};
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
var { CloudSearch } = require('../../../clients/node/client-cloudsearch-node');
1+
var { CloudSearch } = require("../../../clients/node/client-cloudsearch-node");
22

33
module.exports = function() {
4-
this.Before("@cloudsearch", function (callback) {
4+
this.Before("@cloudsearch", function(callback) {
55
this.service = new CloudSearch({});
66
callback();
77
});
88

9-
this.Given(/^I create a domain with name prefix "([^"]*)"$/, function(prefix, callback) {
9+
this.Given(/^I create a domain with name prefix "([^"]*)"$/, function(
10+
prefix,
11+
callback
12+
) {
1013
this.domainName = this.uniqueName(prefix);
11-
this.request(null, 'createDomain', {DomainName: this.domainName}, callback, false);
14+
this.request(
15+
null,
16+
"createDomain",
17+
{ DomainName: this.domainName },
18+
callback,
19+
false
20+
);
1221
});
1322
};
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
var { CloudTrail } = require('../../../clients/node/client-cloudtrail-node');
1+
var { CloudTrail } = require("../../../clients/node/client-cloudtrail-node");
22

33
module.exports = function() {
4-
this.Before("@cloudtrail", function (callback) {
4+
this.Before("@cloudtrail", function(callback) {
55
this.service = new CloudTrail({});
66
callback();
77
});
88

99
this.Given(/^I describe trails$/, function(callback) {
10-
this.request(null, 'describeTrails', {}, callback);
10+
this.request(null, "describeTrails", {}, callback);
1111
});
1212

1313
this.Given(/^I create a trail with an invalid name$/, function(callback) {
14-
this.request(null, 'createTrail', {Name: '', S3BucketName: ''}, callback, false);
14+
this.request(
15+
null,
16+
"createTrail",
17+
{ Name: "", S3BucketName: "" },
18+
callback,
19+
false
20+
);
1521
});
1622
};
Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,51 @@
1-
var { CloudWatch } = require('../../../clients/node/client-cloudwatch-node');
1+
var { CloudWatch } = require("../../../clients/node/client-cloudwatch-node");
22

33
module.exports = function() {
4-
this.Before("@cloudwatch", function (callback) {
4+
this.Before("@cloudwatch", function(callback) {
55
this.service = new CloudWatch({});
66
callback();
77
});
88

9-
this.Given(/^I create a CloudWatch alarm with (prefix|name) "([^"]*)"$/, function(prefix, name, callback) {
10-
var timestamp = new Date().getTime();
11-
this.cloudWatchAlarm = {
12-
AlarmName: name,
13-
MetricName: 'aws-sdk-js-metric-' + timestamp,
14-
Namespace: 'aws-sdk-js-namespace' + timestamp,
15-
ComparisonOperator: 'GreaterThanThreshold',
16-
EvaluationPeriods: 5,
17-
Period: 60,
18-
Statistic: 'Average',
19-
Threshold: 50.0
20-
};
9+
this.Given(
10+
/^I create a CloudWatch alarm with (prefix|name) "([^"]*)"$/,
11+
function(prefix, name, callback) {
12+
var timestamp = new Date().getTime();
13+
this.cloudWatchAlarm = {
14+
AlarmName: name,
15+
MetricName: "aws-sdk-js-metric-" + timestamp,
16+
Namespace: "aws-sdk-js-namespace" + timestamp,
17+
ComparisonOperator: "GreaterThanThreshold",
18+
EvaluationPeriods: 5,
19+
Period: 60,
20+
Statistic: "Average",
21+
Threshold: 50.0
22+
};
2123

22-
if (prefix === 'prefix') {
23-
this.cloudWatchAlarm.AlarmName += '-' + timestamp;
24-
}
24+
if (prefix === "prefix") {
25+
this.cloudWatchAlarm.AlarmName += "-" + timestamp;
26+
}
2527

26-
this.request(null, 'putMetricAlarm', this.cloudWatchAlarm,
27-
callback, prefix === 'name' ? false : undefined);
28-
});
28+
this.request(
29+
null,
30+
"putMetricAlarm",
31+
this.cloudWatchAlarm,
32+
callback,
33+
prefix === "name" ? false : undefined
34+
);
35+
}
36+
);
2937

3038
this.Given(/^I list the CloudWatch alarms$/, function(callback) {
3139
var params = {
3240
MetricName: this.cloudWatchAlarm.MetricName,
3341
Namespace: this.cloudWatchAlarm.Namespace
3442
};
35-
this.request(null, 'describeAlarmsForMetric', params, callback);
43+
this.request(null, "describeAlarmsForMetric", params, callback);
3644
});
3745

38-
this.Then(/^the list should contain the CloudWatch alarm$/, function(callback) {
46+
this.Then(/^the list should contain the CloudWatch alarm$/, function(
47+
callback
48+
) {
3949
var name = this.cloudWatchAlarm.AlarmName;
4050
this.assert.contains(this.data.MetricAlarms, function(alarm) {
4151
return alarm.AlarmName === name;
@@ -44,7 +54,11 @@ module.exports = function() {
4454
});
4555

4656
this.Then(/^I delete the CloudWatch alarm$/, function(callback) {
47-
this.request(null, 'deleteAlarms',
48-
{AlarmNames: [this.cloudWatchAlarm.AlarmName]}, callback);
57+
this.request(
58+
null,
59+
"deleteAlarms",
60+
{ AlarmNames: [this.cloudWatchAlarm.AlarmName] },
61+
callback
62+
);
4963
});
5064
};

features/cloudwatchevents/step_definitions/cloudwatchevents.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
var { CloudWatchEvents } = require('../../../clients/node/client-cloudwatch-events-node');
1+
var {
2+
CloudWatchEvents
3+
} = require("../../../clients/node/client-cloudwatch-events-node");
24

35
module.exports = function() {
4-
this.Before("@cloudwatchevents", function (callback) {
6+
this.Before("@cloudwatchevents", function(callback) {
57
this.service = new CloudWatchEvents({});
68
callback();
79
});

0 commit comments

Comments
 (0)