|
1 |
| -const { Before, Given, Then } = require("@cucumber/cucumber"); |
| 1 | +const { After, Before, Given, Then } = require("@cucumber/cucumber"); |
2 | 2 |
|
3 |
| -Before({ tags: "@elasticache" }, function (scenario, callback) { |
| 3 | +Before({ tags: "@elasticache" }, function () { |
4 | 4 | const { ElastiCache } = require("../../../clients/client-elasticache");
|
5 | 5 | this.service = new ElastiCache({});
|
6 |
| - callback(); |
7 | 6 | });
|
8 | 7 |
|
9 |
| -Given("I create a cache parameter group with name prefix {string}", function (prefix, callback) { |
| 8 | +After({ tags: "@elasticache" }, async function () { |
| 9 | + if (this.cacheGroupName) { |
| 10 | + await this.service.deleteCacheParameterGroup({ CacheParameterGroupName: this.cacheGroupName }); |
| 11 | + this.cacheGroupName = undefined; |
| 12 | + } |
| 13 | +}); |
| 14 | + |
| 15 | +Given("I create a cache parameter group with name prefix {string}", async function (prefix) { |
10 | 16 | this.cacheGroupName = this.uniqueName(prefix);
|
11 | 17 | const params = {
|
12 | 18 | Description: "Description",
|
13 | 19 | CacheParameterGroupName: this.cacheGroupName,
|
14 | 20 | CacheParameterGroupFamily: "memcached1.4",
|
15 | 21 | };
|
16 |
| - this.request(null, "createCacheParameterGroup", params, callback, false); |
| 22 | + try { |
| 23 | + this.data = await this.service.createCacheParameterGroup(params); |
| 24 | + } catch (error) { |
| 25 | + this.error = error; |
| 26 | + } |
17 | 27 | });
|
18 | 28 |
|
19 |
| -Given("the cache parameter group name is in the result", function (callback) { |
| 29 | +Given("the cache parameter group name is in the result", async function () { |
20 | 30 | const name = this.data.CacheParameterGroup.CacheParameterGroupName;
|
21 | 31 | this.assert.equal(name, this.cacheGroupName);
|
22 |
| - callback(); |
23 | 32 | });
|
24 | 33 |
|
25 |
| -Given("I describe the cache parameter groups", function (callback) { |
26 |
| - const params = { |
27 |
| - CacheParameterGroupName: this.cacheGroupName, |
28 |
| - }; |
29 |
| - this.request(null, "describeCacheParameterGroups", params, callback); |
| 34 | +Given("I describe the cache parameter groups", async function () { |
| 35 | + const params = { CacheParameterGroupName: this.cacheGroupName }; |
| 36 | + try { |
| 37 | + this.data = await this.service.describeCacheParameterGroups(params); |
| 38 | + } catch (error) { |
| 39 | + this.error = error; |
| 40 | + } |
30 | 41 | });
|
31 | 42 |
|
32 |
| -Then("the cache parameter group should be described", function (callback) { |
| 43 | +Then("the cache parameter group should be described", function () { |
33 | 44 | const item = this.data.CacheParameterGroups[0];
|
34 | 45 | this.assert.equal(item.CacheParameterGroupName, this.cacheGroupName);
|
35 |
| - callback(); |
36 |
| -}); |
37 |
| - |
38 |
| -Then("I delete the cache parameter group", function (callback) { |
39 |
| - const params = { |
40 |
| - CacheParameterGroupName: this.cacheGroupName, |
41 |
| - }; |
42 |
| - this.request(null, "deleteCacheParameterGroup", params, callback); |
43 | 46 | });
|
0 commit comments