Skip to content

Commit 6fe9d69

Browse files
Localstack
1 parent 4e6ac31 commit 6fe9d69

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

docs/modules/localstack.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Localstack Module
2-
3-
[Localstack](https://www.localstack.cloud/): Develop and test your AWS applications locally to reduce development time and increase product velocity
1+
# Localstack
42

53
## Install
64

@@ -10,6 +8,17 @@ npm install @testcontainers/localstack --save-dev
108

119
## Examples
1210

11+
These examples use the following libraries:
12+
13+
- [@aws-sdk/client-s3](https://www.npmjs.com/package/@aws-sdk/client-s3)
14+
15+
npm install @aws-sdk/client-s3
16+
17+
Choose an image from the [container registry](https://hub.docker.com/r/localstack/localstack) and substitute `IMAGE`.
18+
19+
### Create a S3 bucket
20+
1321
<!--codeinclude-->
14-
[Create a S3 bucket:](../../packages/modules/localstack/src/localstack-container.test.ts) inside_block:createS3Bucket
22+
[Create a S3 bucket:](../../packages/modules/localstack/src/localstack-container.test.ts) inside_block:localstackCreateS3Bucket
1523
<!--/codeinclude-->
24+

packages/modules/localstack/src/localstack-container.test.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const runAwsCliAgainstDockerNetworkContainer = async (
1717
};
1818

1919
describe("LocalStackContainer", { timeout: 180_000 }, () => {
20-
// createS3Bucket {
2120
it("should create a S3 bucket", async () => {
21+
// localstackCreateS3Bucket {
2222
await using container = await new LocalstackContainer(IMAGE).start();
2323

2424
const client = new S3Client({
@@ -30,17 +30,14 @@ describe("LocalStackContainer", { timeout: 180_000 }, () => {
3030
accessKeyId: "test",
3131
},
3232
});
33-
const input = {
34-
Bucket: "testcontainers",
35-
};
33+
34+
const input = { Bucket: "testcontainers" };
3635
const command = new CreateBucketCommand(input);
3736

38-
const createBucketResponse = await client.send(command);
39-
expect(createBucketResponse.$metadata.httpStatusCode).toEqual(200);
40-
const headBucketResponse = await client.send(new HeadBucketCommand(input));
41-
expect(headBucketResponse.$metadata.httpStatusCode).toEqual(200);
37+
expect((await client.send(command)).$metadata.httpStatusCode).toEqual(200);
38+
expect((await client.send(new HeadBucketCommand(input))).$metadata.httpStatusCode).toEqual(200);
39+
// }
4240
});
43-
// }
4441

4542
it("should use custom network", async () => {
4643
await using network = await new Network().start();

0 commit comments

Comments
 (0)