|
1 |
| -const { Before, Given, Then } = require("@cucumber/cucumber"); |
| 1 | +const { After, Before, Given, Then } = require("@cucumber/cucumber"); |
2 | 2 |
|
3 |
| -Before({ tags: "@elasticbeanstalk" }, function (scenario, callback) { |
| 3 | +Before({ tags: "@elasticbeanstalk" }, function () { |
4 | 4 | const { ElasticBeanstalk } = require("../../../clients/client-elastic-beanstalk");
|
5 | 5 | this.service = new ElasticBeanstalk({});
|
6 |
| - callback(); |
7 | 6 | });
|
8 | 7 |
|
9 |
| -Given("I create an Elastic Beanstalk application with name prefix {string}", function (prefix, callback) { |
| 8 | +After({ tags: "@elasticbeanstalk" }, async function () { |
| 9 | + if (this.appName) { |
| 10 | + await this.service.deleteApplication({ ApplicationName: this.appName }); |
| 11 | + this.appName = undefined; |
| 12 | + } |
| 13 | +}); |
| 14 | + |
| 15 | +Given("I create an Elastic Beanstalk application with name prefix {string}", async function (prefix) { |
10 | 16 | this.appName = this.uniqueName(prefix);
|
11 |
| - const params = { ApplicationName: this.appName }; |
12 |
| - this.request(null, "createApplication", params, callback, false); |
| 17 | + try { |
| 18 | + this.data = await this.service.createApplication({ ApplicationName: this.appName }); |
| 19 | + } catch (error) { |
| 20 | + this.error = error; |
| 21 | + } |
13 | 22 | });
|
14 | 23 |
|
15 |
| -Given("I create an Elastic Beanstalk application version with label {string}", function (label, callback) { |
| 24 | +Given("I create an Elastic Beanstalk application version with label {string}", async function (label) { |
16 | 25 | this.appVersion = label;
|
17 | 26 | const params = {
|
18 | 27 | ApplicationName: this.appName,
|
19 | 28 | VersionLabel: this.appVersion,
|
20 | 29 | };
|
21 |
| - this.request(null, "createApplicationVersion", params, callback); |
| 30 | + await this.service.createApplicationVersion(params); |
22 | 31 | });
|
23 | 32 |
|
24 |
| -Given("I describe the Elastic Beanstalk application", function (callback) { |
| 33 | +Given("I describe the Elastic Beanstalk application", async function () { |
25 | 34 | const params = { ApplicationNames: [this.appName] };
|
26 |
| - this.request(null, "describeApplications", params, callback); |
| 35 | + this.data = await this.service.describeApplications(params); |
27 | 36 | });
|
28 | 37 |
|
29 |
| -Then("the result should contain the Elastic Beanstalk application version", function (callback) { |
| 38 | +Then("the result should contain the Elastic Beanstalk application version", function () { |
30 | 39 | this.assert.deepEqual(this.data.Applications[0].Versions, [this.appVersion]);
|
31 |
| - callback(); |
32 | 40 | });
|
33 | 41 |
|
34 |
| -Then("the result should contain the Elastic Beanstalk application name", function (callback) { |
| 42 | +Then("the result should contain the Elastic Beanstalk application name", function () { |
35 | 43 | this.assert.equal(this.data.Applications[0].ApplicationName, this.appName);
|
36 |
| - callback(); |
37 |
| -}); |
38 |
| - |
39 |
| -Then("I delete the Elastic Beanstalk application", function (callback) { |
40 |
| - const params = { ApplicationName: this.appName }; |
41 |
| - this.request(null, "deleteApplication", params, callback); |
42 | 44 | });
|
0 commit comments