@@ -29,101 +29,8 @@ or [npm](https://www.npmjs.com/)
2929npm 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 )
0 commit comments