- invoke()
- clearAllItems()
- writeItems()
- clearAllObjects()
- deleteAllLogs()
- stopRunningExecutions()
- deploy()
Invokes a lambda function
const { invoke } = require('aws-testing-library/lib/utils/lambda');
const result = await invoke(
'us-east-1',
'functionName',
{
body: JSON.stringify({ text: 'from e2e test' }),
} /* optional: payload for the lambda */,
);
Clear all items in a DynamoDb table
const { clearAllItems } = require('aws-testing-library/lib/utils/dynamoDb');
await clearAllItems('us-east-1', 'dynamo-db-table');
Write items to a DynamoDb table
const { writeItems } = require('aws-testing-library/lib/utils/dynamoDb');
const items = require('./seed.json');
await writeItems('us-east-1', 'dynamo-db-table', items);
Clear all objects in a s3 bucket
const { clearAllObjects } = require('aws-testing-library/lib/utils/s3');
await clearAllObjects(
'us-east-1',
's3-bucket',
'key-prefix' /* optional, only delete objects with keys that begin with the specified prefix*/,
);
Clear all log streams for a lambda function
const { deleteAllLogs } = require('aws-testing-library/lib/utils/cloudwatch');
await deleteAllLogs('us-east-1', 'lambda-function-name');
Stop all running executions for a state machine
const {
stopRunningExecutions,
} = require('aws-testing-library/lib/utils/stepFunctions');
await stopRunningExecutions('us-east-1', 'state-machine-arn');
Deploys the current service using Serverless framework
const { deploy } = require('aws-testing-library/lib/utils/serverless');
await deploy('dev' /* optional - deployment stage */);