-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Expand file tree
/
Copy pathdelete-table.integration.test.js
More file actions
47 lines (42 loc) · 1.27 KB
/
delete-table.integration.test.js
File metadata and controls
47 lines (42 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { describe, it, expect, beforeAll } from "vitest";
import {
CreateTableCommand,
DynamoDBClient,
waitUntilTableExists,
} from "@aws-sdk/client-dynamodb";
import { main } from "../actions/delete-table.js";
import { DescribeTableCommand } from "@aws-sdk/client-dynamodb";
describe("delete-table", () => {
const tableName = "DecafCoffees";
const client = new DynamoDBClient({});
beforeAll(async () => {
const createTableCommand = new CreateTableCommand({
TableName: tableName,
AttributeDefinitions: [
{
AttributeName: "Brand",
AttributeType: "S",
},
],
KeySchema: [
{
AttributeName: "Brand",
KeyType: "HASH",
},
],
BillingMode: "PAY_PER_REQUEST",
});
await client.send(createTableCommand);
await waitUntilTableExists({ client }, { TableName: tableName });
});
it("should delete the table", async () => {
await main();
const describeTableCommand = new DescribeTableCommand({
TableName: tableName,
});
const response = await client.send(describeTableCommand);
expect(response.Table.TableStatus).toBe("DELETING");
});
});