|
1 |
| -const { Before, Given, Then } = require("@cucumber/cucumber"); |
| 1 | +const { After, Before, Given } = require("@cucumber/cucumber"); |
2 | 2 |
|
3 |
| -Before({ tags: "@cognitoidentity" }, function (scenario, callback) { |
| 3 | +Before({ tags: "@cognitoidentity" }, function () { |
4 | 4 | const { CognitoIdentity } = require("../../../clients/client-cognito-identity");
|
5 | 5 | this.service = new CognitoIdentity({});
|
6 |
| - callback(); |
7 | 6 | });
|
8 | 7 |
|
9 |
| -Given("I create a Cognito identity pool with prefix {string}", function (prefix, callback) { |
10 |
| - const expectError = prefix === "" ? false : undefined; |
11 |
| - const params = { |
12 |
| - IdentityPoolName: this.uniqueName(prefix, ""), |
13 |
| - AllowUnauthenticatedIdentities: true, |
14 |
| - }; |
15 |
| - this.request(null, "createIdentityPool", params, callback, expectError); |
| 8 | +After({ tags: "@cognitoidentity" }, async function () { |
| 9 | + if (this.identityPoolId) { |
| 10 | + this.service.deleteIdentityPool({ IdentityPoolId: this.identityPoolId }); |
| 11 | + this.identityPoolId = undefined; |
| 12 | + } |
16 | 13 | });
|
17 | 14 |
|
18 |
| -Given("I describe the Cognito identity pool ID", function (callback) { |
19 |
| - this.identityPoolId = this.data.IdentityPoolId; |
20 |
| - this.request(null, "describeIdentityPool", { IdentityPoolId: this.data.IdentityPoolId }, callback); |
| 15 | +Given("I create a Cognito identity pool with prefix {string}", async function (prefix) { |
| 16 | + try { |
| 17 | + this.data = await this.service.createIdentityPool({ |
| 18 | + IdentityPoolName: this.uniqueName(prefix), |
| 19 | + AllowUnauthenticatedIdentities: true, |
| 20 | + }); |
| 21 | + this.identityPoolId = this.data.IdentityPoolId; |
| 22 | + } catch (error) { |
| 23 | + this.error = error; |
| 24 | + } |
21 | 25 | });
|
22 | 26 |
|
23 |
| -Then("I delete the Cognito identity pool", function (callback) { |
24 |
| - this.request(null, "deleteIdentityPool", { IdentityPoolId: this.identityPoolId }, callback); |
| 27 | +Given("I describe the Cognito identity pool ID", async function () { |
| 28 | + this.data = await this.service.describeIdentityPool({ IdentityPoolId: this.identityPoolId }); |
25 | 29 | });
|
0 commit comments