Skip to content

Commit 76af564

Browse files
authored
feat: use simplified cucumber expressions (#1076)
1 parent 6b7d5f0 commit 76af564

File tree

36 files changed

+276
-294
lines changed

36 files changed

+276
-294
lines changed

features/autoscaling/step_definitions/autoscaling.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ Given("I create a launch configuration with name {string}", function(
1818
this.request(null, "createLaunchConfiguration", params, callback, false);
1919
});
2020

21-
Given(/^I describe launch configurations$/, function(callback) {
21+
Given("I describe launch configurations", function(callback) {
2222
this.request(null, "describeLaunchConfigurations", {}, callback);
2323
});
2424

25-
Then(/^the list should contain the launch configuration "([^"]*)"$/, function(
25+
Then("the list should contain the launch configuration {string}", function(
2626
name,
2727
callback
2828
) {
@@ -32,7 +32,7 @@ Then(/^the list should contain the launch configuration "([^"]*)"$/, function(
3232
callback();
3333
});
3434

35-
Then(/^I delete the launch configuration "([^"]*)"$/, function(name, callback) {
35+
Then("I delete the launch configuration {string}", function(name, callback) {
3636
const params = { LaunchConfigurationName: name };
3737
this.request(null, "deleteLaunchConfiguration", params, callback);
3838
});

features/cloudfront/step_definitions/cloudfront.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { CloudFront } = require("../../../clients/client-cloudfront");
2-
const { Before, Given, Then, When } = require("cucumber");
2+
const { Before, Given } = require("cucumber");
33

44
const createParams = {
55
CallerReference: "",
@@ -75,6 +75,6 @@ Given("I create a CloudFront distribution with name prefix {string}", function(
7575
);
7676
});
7777

78-
Given(/^I list CloudFront distributions$/, function(callback) {
78+
Given("I list CloudFront distributions", function(callback) {
7979
this.request(null, "listDistributions", {}, callback);
8080
});

features/cloudtrail/step_definitions/cloudtrail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Before({ tags: "@cloudtrail" }, function(scenario, callback) {
66
callback();
77
});
88

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

13-
Given(/^I create a trail with an invalid name$/, function(callback) {
13+
Given("I create a trail with an invalid name", function(callback) {
1414
this.request(
1515
null,
1616
"createTrail",

features/cloudwatch/step_definitions/cloudwatch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@ Given("I create a CloudWatch alarm with name {string}", function(
5252
this.request(null, "putMetricAlarm", this.cloudWatchAlarm, callback, false);
5353
});
5454

55-
Given(/^I list the CloudWatch alarms$/, function(callback) {
55+
Given("I list the CloudWatch alarms", function(callback) {
5656
const params = {
5757
MetricName: this.cloudWatchAlarm.MetricName,
5858
Namespace: this.cloudWatchAlarm.Namespace
5959
};
6060
this.request(null, "describeAlarmsForMetric", params, callback);
6161
});
6262

63-
Then(/^the list should contain the CloudWatch alarm$/, function(callback) {
63+
Then("the list should contain the CloudWatch alarm", function(callback) {
6464
const name = this.cloudWatchAlarm.AlarmName;
6565
this.assert.contains(this.data.MetricAlarms, function(alarm) {
6666
return alarm.AlarmName === name;
6767
});
6868
callback();
6969
});
7070

71-
Then(/^I delete the CloudWatch alarm$/, function(callback) {
71+
Then("I delete the CloudWatch alarm", function(callback) {
7272
this.request(
7373
null,
7474
"deleteAlarms",

features/cloudwatchlogs/step_definitions/cloudwatchlogs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ Given("I create a CloudWatch logGroup with prefix {string}", function(
2121
);
2222
});
2323

24-
Given(/^I list the CloudWatch logGroups$/, function(callback) {
24+
Given("I list the CloudWatch logGroups", function(callback) {
2525
this.request(null, "describeLogGroups", {}, callback);
2626
});
2727

28-
Then(/^the list should contain the CloudWatch logGroup$/, function(callback) {
28+
Then("the list should contain the CloudWatch logGroup", function(callback) {
2929
const name = this.logGroupName;
3030
this.assert.contains(this.data.logGroups, function(alarm) {
3131
return alarm.logGroupName === name;
3232
});
3333
callback();
3434
});
3535

36-
Then(/^I delete the CloudWatch logGroup$/, function(callback) {
36+
Then("I delete the CloudWatch logGroup", function(callback) {
3737
this.request(
3838
null,
3939
"deleteLogGroup",

features/cognitoidentity/step_definitions/cognitoidentity.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Given("I create a Cognito identity pool with prefix {string}", function(
1818
this.request(null, "createIdentityPool", params, callback, expectError);
1919
});
2020

21-
Given(/^I describe the Cognito identity pool ID$/, function(callback) {
21+
Given("I describe the Cognito identity pool ID", function(callback) {
2222
this.identityPoolId = this.data.IdentityPoolId;
2323
this.request(
2424
null,
@@ -28,7 +28,7 @@ Given(/^I describe the Cognito identity pool ID$/, function(callback) {
2828
);
2929
});
3030

31-
Then(/^I delete the Cognito identity pool$/, function(callback) {
31+
Then("I delete the Cognito identity pool", function(callback) {
3232
this.request(
3333
null,
3434
"deleteIdentityPool",

features/cognitosync/step_definitions/cognitosync.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Before({ tags: "@cognitosync" }, function(scenario, callback) {
66
callback();
77
});
88

9-
Given(/^I list Cognito identity pool usage$/, function(callback) {
9+
Given("I list Cognito identity pool usage", function(callback) {
1010
this.request(null, "listIdentityPoolUsage", {}, callback);
1111
});
1212

1313
Given(
14-
/^I list Cognito data sets with identity pool id "([^"]*)" and identity id "([^"]*)"$/,
14+
"I list Cognito data sets with identity pool id {string} and identity id {string}",
1515
function(idpid, idid, callback) {
1616
const params = { IdentityPoolId: idpid, IdentityId: idid };
1717
this.request(null, "listDatasets", params, callback, false);

features/directconnect/step_definitions/directconnect.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ Before({ tags: "@directconnect" }, function(scenario, callback) {
66
callback();
77
});
88

9-
Given(
10-
/^I create a Direct Connect connection with an invalid location$/,
11-
function(callback) {
12-
const params = {
13-
bandwidth: "1Gbps",
14-
location: "INVALID_LOCATION",
15-
connectionName: this.uniqueName("aws-sdk-js")
16-
};
17-
this.request(null, "createConnection", params, callback, false);
18-
}
19-
);
9+
Given("I create a Direct Connect connection with an invalid location", function(
10+
callback
11+
) {
12+
const params = {
13+
bandwidth: "1Gbps",
14+
location: "INVALID_LOCATION",
15+
connectionName: this.uniqueName("aws-sdk-js")
16+
};
17+
this.request(null, "createConnection", params, callback, false);
18+
});

features/dynamodb/step_definitions/dynamodb.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function createTable(world, callback) {
8989
});
9090
}
9191

92-
Given(/^I have a table$/, function(callback) {
92+
Given("I have a table", function(callback) {
9393
const world = this;
9494
this.service.listTables({}, function(err, data) {
9595
for (let i = 0; i < data.TableNames.length; i++) {
@@ -102,7 +102,7 @@ Given(/^I have a table$/, function(callback) {
102102
});
103103
});
104104

105-
When(/^I create a table$/, function(callback) {
105+
When("I create a table", function(callback) {
106106
const world = this;
107107
this.tableName = this.uniqueName("aws-sdk-js-integration");
108108
this.service.listTables({}, function(err, data) {
@@ -116,12 +116,12 @@ When(/^I create a table$/, function(callback) {
116116
});
117117
});
118118

119-
When(/^I put the item:$/, function(string, next) {
119+
When("I put the item:", function(string, next) {
120120
const params = { TableName: this.tableName, Item: JSON.parse(string) };
121121
this.request(null, "putItem", params, next);
122122
});
123123

124-
When(/^I put a recursive item$/, function(next) {
124+
When("I put a recursive item", function(next) {
125125
const params = {
126126
TableName: this.tableName,
127127
Item: {
@@ -146,12 +146,12 @@ When(/^I put a recursive item$/, function(next) {
146146
this.request(null, "putItem", params, next);
147147
});
148148

149-
Then(/^the item with id "([^"]*)" should exist$/, function(key, next) {
149+
Then("the item with id {string} should exist", function(key, next) {
150150
const params = { TableName: this.tableName, Key: { id: { S: key } } };
151151
this.request(null, "getItem", params, next);
152152
});
153153

154-
Then(/^it should have attribute "([^"]*)" containing "([^"]*)"$/, function(
154+
Then("it should have attribute {string} containing {string}", function(
155155
attr,
156156
value,
157157
next
@@ -160,20 +160,20 @@ Then(/^it should have attribute "([^"]*)" containing "([^"]*)"$/, function(
160160
next();
161161
});
162162

163-
When(/^I delete the table$/, function(next) {
163+
When("I delete the table", function(next) {
164164
const params = { TableName: this.tableName };
165165
this.request(null, "deleteTable", params, next);
166166
});
167167

168-
Then(/^the table should eventually exist$/, function(callback) {
168+
Then("the table should eventually exist", function(callback) {
169169
waitForTableExists(this, callback);
170170
});
171171

172-
Then(/^the table should eventually not exist$/, function(callback) {
172+
Then("the table should eventually not exist", function(callback) {
173173
waitForTableNotExists(this, callback);
174174
});
175175

176-
Given(/^my first request is corrupted with CRC checking (ON|OFF)$/, function(
176+
Given("my first request is corrupted with CRC checking (ON|OFF)", function(
177177
toggle,
178178
callback
179179
) {
@@ -198,15 +198,15 @@ Given(/^my first request is corrupted with CRC checking (ON|OFF)$/, function(
198198
req.send();
199199
});
200200

201-
Then(/^the request should( not)? be retried$/, function(retry, callback) {
201+
Then("the request should( not)? be retried", function(retry, callback) {
202202
if (retry && this.response.retryCount > 0)
203203
callback(new Error("Request was incorrectly retried"));
204204
if (!retry && this.response.retryCount == 0)
205205
callback(new Error("Request was incorrectly retried"));
206206
callback();
207207
});
208208

209-
Given(/^all of my requests are corrupted with CRC checking ON$/, function(
209+
Given("all of my requests are corrupted with CRC checking ON", function(
210210
callback
211211
) {
212212
const world = this;
@@ -223,15 +223,13 @@ Given(/^all of my requests are corrupted with CRC checking ON$/, function(
223223
req.send();
224224
});
225225

226-
When(/^the request is retried the maximum number of times$/, function(
227-
callback
228-
) {
226+
When("the request is retried the maximum number of times", function(callback) {
229227
if (this.response.retryCount != 2)
230228
callback(new Error("Incorrect retry count"));
231229
callback();
232230
});
233231

234-
Then(/^the request should( not)? fail with a CRC checking error$/, function(
232+
Then("the request should( not)? fail with a CRC checking error", function(
235233
failed,
236234
callback
237235
) {
@@ -241,15 +239,16 @@ Then(/^the request should( not)? fail with a CRC checking error$/, function(
241239
callback();
242240
});
243241

244-
Given(
245-
/^I try to delete an item with key "([^"]*)" from table "([^"]*)"$/,
246-
function(key, table, callback) {
247-
const params = { TableName: table, Key: { id: { S: key } } };
248-
this.request(null, "deleteItem", params, callback, false);
249-
}
250-
);
242+
Given("I try to delete an item with key {string} from table {string}", function(
243+
key,
244+
table,
245+
callback
246+
) {
247+
const params = { TableName: table, Key: { id: { S: key } } };
248+
this.request(null, "deleteItem", params, callback, false);
249+
});
251250

252-
Given(/^I try to delete a table with an empty table parameter$/, function(
251+
Given("I try to delete a table with an empty table parameter", function(
253252
callback
254253
) {
255254
this.request(null, "deleteTable", { TableName: "" }, callback, false);

features/ec2/step_definitions/ec2.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ Before({ tags: "@ec2" }, function(scenario, callback) {
4444
callback();
4545
});
4646

47-
Given(/^I describe EC2 regions "([^"]*)"$/, function(regions, callback) {
47+
Given("I describe EC2 regions {string}", function(regions, callback) {
4848
regions = regions.split(/\s*,\s*/);
4949
this.request(null, "describeRegions", { RegionNames: regions }, callback);
5050
});
5151

52-
Then(/^the EC2 endpoint for "([^"]*)" should be "([^"]*)"$/, function(
52+
Then("the EC2 endpoint for {string} should be {string}", function(
5353
region,
5454
endpoint,
5555
callback
@@ -70,7 +70,7 @@ Given("I describe the EC2 instance {string}", function(instanceId, callback) {
7070
);
7171
});
7272

73-
Given(/^I attempt to copy an encrypted snapshot across regions$/, function(
73+
Given("I attempt to copy an encrypted snapshot across regions", function(
7474
callback
7575
) {
7676
const self = this;
@@ -128,7 +128,7 @@ Given(/^I attempt to copy an encrypted snapshot across regions$/, function(
128128
});
129129
});
130130

131-
Then(/^the copy snapshot attempt should be successful$/, function(callback) {
131+
Then("the copy snapshot attempt should be successful", function(callback) {
132132
this.assert.equal(this.success, true);
133133
callback();
134134
});

features/elasticache/step_definitions/elasticache.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ Given("I create a cache parameter group with name prefix {string}", function(
1919
this.request(null, "createCacheParameterGroup", params, callback, false);
2020
});
2121

22-
Given(/^the cache parameter group name is in the result$/, function(callback) {
22+
Given("the cache parameter group name is in the result", function(callback) {
2323
const name = this.data.CacheParameterGroup.CacheParameterGroupName;
2424
this.assert.equal(name, this.cacheGroupName);
2525
callback();
2626
});
2727

28-
Given(/^I describe the cache parameter groups$/, function(callback) {
28+
Given("I describe the cache parameter groups", function(callback) {
2929
const params = {
3030
CacheParameterGroupName: this.cacheGroupName
3131
};
3232
this.request(null, "describeCacheParameterGroups", params, callback);
3333
});
3434

35-
Then(/^the cache parameter group should be described$/, function(callback) {
35+
Then("the cache parameter group should be described", function(callback) {
3636
const item = this.data.CacheParameterGroups[0];
3737
this.assert.equal(item.CacheParameterGroupName, this.cacheGroupName);
3838
callback();
3939
});
4040

41-
Then(/^I delete the cache parameter group$/, function(callback) {
41+
Then("I delete the cache parameter group", function(callback) {
4242
const params = {
4343
CacheParameterGroupName: this.cacheGroupName
4444
};

features/elasticbeanstalk/step_definitions/elasticbeanstalk.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ Given(
2929
}
3030
);
3131

32-
Given(/^I describe the Elastic Beanstalk application$/, function(callback) {
32+
Given("I describe the Elastic Beanstalk application", function(callback) {
3333
const params = { ApplicationNames: [this.appName] };
3434
this.request(null, "describeApplications", params, callback);
3535
});
3636

3737
Then(
38-
/^the result should contain the Elastic Beanstalk application version$/,
38+
"the result should contain the Elastic Beanstalk application version",
3939
function(callback) {
4040
this.assert.deepEqual(this.data.Applications[0].Versions, [
4141
this.appVersion
@@ -45,14 +45,14 @@ Then(
4545
);
4646

4747
Then(
48-
/^the result should contain the Elastic Beanstalk application name$/,
48+
"the result should contain the Elastic Beanstalk application name",
4949
function(callback) {
5050
this.assert.equal(this.data.Applications[0].ApplicationName, this.appName);
5151
callback();
5252
}
5353
);
5454

55-
Then(/^I delete the Elastic Beanstalk application$/, function(callback) {
55+
Then("I delete the Elastic Beanstalk application", function(callback) {
5656
const params = { ApplicationName: this.appName };
5757
this.request(null, "deleteApplication", params, callback);
5858
});

0 commit comments

Comments
 (0)