Skip to content

Commit c587960

Browse files
committed
update readme
1 parent 8df76a8 commit c587960

File tree

3 files changed

+96
-95
lines changed

3 files changed

+96
-95
lines changed

README.md

Lines changed: 2 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -29,101 +29,8 @@ or [npm](https://www.npmjs.com/)
2929
npm install aws-testing-library --save-dev
3030
```
3131

32-
## Setup
32+
## Usage
3333

3434
- [Chai](src/chai/README.md)
3535
- [Jest](src/jest/README.md)
36-
37-
## Utils
38-
39-
- [invoke()](#invoke)
40-
- [clearAllItems()](#clearallitems)
41-
- [writeItems()](#writeitems)
42-
- [clearAllObjects()](#clearallobjects)
43-
- [deleteAllLogs()](#deletealllogs)
44-
- [stopRunningExecutions()](#stoprunningexecutions)
45-
- [deploy()](#deploy)
46-
47-
### `invoke()`
48-
49-
Invokes a lambda function
50-
51-
```typescript
52-
const { invoke } = require('aws-testing-library/lib/utils/lambda');
53-
54-
const result = await invoke(
55-
'us-east-1',
56-
'functionName',
57-
{
58-
body: JSON.stringify({ text: 'from e2e test' }),
59-
} /* optional: payload for the lambda */,
60-
);
61-
```
62-
63-
### `clearAllItems()`
64-
65-
Clear all items in a DynamoDb table
66-
67-
```typescript
68-
const { clearAllItems } = require('aws-testing-library/lib/utils/dynamoDb');
69-
70-
await clearAllItems('us-east-1', 'dynamo-db-table');
71-
```
72-
73-
### `writeItems()`
74-
75-
Write items to a DynamoDb table
76-
77-
```typescript
78-
const { writeItems } = require('aws-testing-library/lib/utils/dynamoDb');
79-
80-
const items = require('./seed.json');
81-
82-
await writeItems('us-east-1', 'dynamo-db-table', items);
83-
```
84-
85-
### `clearAllObjects()`
86-
87-
Clear all objects in a s3 bucket
88-
89-
```typescript
90-
const { clearAllObjects } = require('aws-testing-library/lib/utils/s3');
91-
92-
await clearAllObjects(
93-
'us-east-1',
94-
's3-bucket',
95-
'key-prefix' /* optional, only delete objects with keys that begin with the specified prefix*/,
96-
);
97-
```
98-
99-
### `deleteAllLogs()`
100-
101-
Clear all log streams for a lambda function
102-
103-
```typescript
104-
const { deleteAllLogs } = require('aws-testing-library/lib/utils/cloudwatch');
105-
106-
await deleteAllLogs('us-east-1', 'lambda-function-name');
107-
```
108-
109-
### `stopRunningExecutions()`
110-
111-
Stop all running executions for a state machine
112-
113-
```typescript
114-
const {
115-
stopRunningExecutions,
116-
} = require('aws-testing-library/lib/utils/stepFunctions');
117-
118-
await stopRunningExecutions('us-east-1', 'state-machine-arn');
119-
```
120-
121-
### `deploy()`
122-
123-
Deploys the current service using [Serverless framework](https://serverless.com/)
124-
125-
```typescript
126-
const { deploy } = require('aws-testing-library/lib/utils/serverless');
127-
128-
await deploy('dev' /* optional - deployment stage */);
129-
```
36+
- [Utils](src/utils/README.md)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"aws",
2424
"jest",
2525
"chai",
26+
"mocha",
2627
"s3",
2728
"dynamoDb",
2829
"api",

src/utils/README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
## Utils
2+
3+
- [invoke()](#invoke)
4+
- [clearAllItems()](#clearallitems)
5+
- [writeItems()](#writeitems)
6+
- [clearAllObjects()](#clearallobjects)
7+
- [deleteAllLogs()](#deletealllogs)
8+
- [stopRunningExecutions()](#stoprunningexecutions)
9+
- [deploy()](#deploy)
10+
11+
### `invoke()`
12+
13+
Invokes a lambda function
14+
15+
```typescript
16+
const { invoke } = require('aws-testing-library/lib/utils/lambda');
17+
18+
const result = await invoke(
19+
'us-east-1',
20+
'functionName',
21+
{
22+
body: JSON.stringify({ text: 'from e2e test' }),
23+
} /* optional: payload for the lambda */,
24+
);
25+
```
26+
27+
### `clearAllItems()`
28+
29+
Clear all items in a DynamoDb table
30+
31+
```typescript
32+
const { clearAllItems } = require('aws-testing-library/lib/utils/dynamoDb');
33+
34+
await clearAllItems('us-east-1', 'dynamo-db-table');
35+
```
36+
37+
### `writeItems()`
38+
39+
Write items to a DynamoDb table
40+
41+
```typescript
42+
const { writeItems } = require('aws-testing-library/lib/utils/dynamoDb');
43+
44+
const items = require('./seed.json');
45+
46+
await writeItems('us-east-1', 'dynamo-db-table', items);
47+
```
48+
49+
### `clearAllObjects()`
50+
51+
Clear all objects in a s3 bucket
52+
53+
```typescript
54+
const { clearAllObjects } = require('aws-testing-library/lib/utils/s3');
55+
56+
await clearAllObjects(
57+
'us-east-1',
58+
's3-bucket',
59+
'key-prefix' /* optional, only delete objects with keys that begin with the specified prefix*/,
60+
);
61+
```
62+
63+
### `deleteAllLogs()`
64+
65+
Clear all log streams for a lambda function
66+
67+
```typescript
68+
const { deleteAllLogs } = require('aws-testing-library/lib/utils/cloudwatch');
69+
70+
await deleteAllLogs('us-east-1', 'lambda-function-name');
71+
```
72+
73+
### `stopRunningExecutions()`
74+
75+
Stop all running executions for a state machine
76+
77+
```typescript
78+
const {
79+
stopRunningExecutions,
80+
} = require('aws-testing-library/lib/utils/stepFunctions');
81+
82+
await stopRunningExecutions('us-east-1', 'state-machine-arn');
83+
```
84+
85+
### `deploy()`
86+
87+
Deploys the current service using [Serverless framework](https://serverless.com/)
88+
89+
```typescript
90+
const { deploy } = require('aws-testing-library/lib/utils/serverless');
91+
92+
await deploy('dev' /* optional - deployment stage */);
93+
```

0 commit comments

Comments
 (0)