forked from testcontainers/testcontainers-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths3mock-container.test.ts
More file actions
29 lines (24 loc) · 1.01 KB
/
s3mock-container.test.ts
File metadata and controls
29 lines (24 loc) · 1.01 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
import { CreateBucketCommand, HeadBucketCommand, S3Client } from "@aws-sdk/client-s3";
import { getImage } from "../../../testcontainers/src/utils/test-helper";
import { S3MockContainer } from "./s3mock-container";
const IMAGE = getImage(__dirname);
describe("S3MockContainer", { timeout: 180_000 }, () => {
it("should create a S3 bucket", async () => {
// s3mockCreateS3Bucket {
await using container = await new S3MockContainer(IMAGE).start();
const client = new S3Client({
endpoint: container.getHttpConnectionUrl(),
forcePathStyle: true,
region: "auto",
credentials: {
secretAccessKey: container.getSecretAccessKey(),
accessKeyId: container.getAccessKeyId(),
},
});
const input = { Bucket: "testcontainers" };
const command = new CreateBucketCommand(input);
expect((await client.send(command)).$metadata.httpStatusCode).toEqual(200);
expect((await client.send(new HeadBucketCommand(input))).$metadata.httpStatusCode).toEqual(200);
// }
});
});