Name: aws-event-mocks
Owner: Serverless
Description: null
Created: 2016-09-28 06:07:23.0
Updated: 2018-05-10 02:29:14.0
Pushed: 2017-10-25 06:42:43.0
Homepage: null
Size: 14
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A small library that includes details mocks of AWS Lambda event sources. Useful for use when unit testing your Lambda functions. Supported Event Sources are: SNS, API Gateway, S3, & Scheduled.
The library simply uses default event source mock templates and merge it with any overwrite you provide. Check out the JSON template files to learn more about the data structure of each event source.
t createEvent = require('aws-event-mocks');
t mocked = createEvent({
mplate: 'aws:sns',
rge: {
Records: [{
Sns: {
Message: 'trigger-email'
}
}]
t createEvent = require('aws-event-mocks');
t event = createEvent({
mplate: 'aws:apiGateway',
rge: {
body: {
first_name: 'Sam',
last_name: 'Smith'
}
t createEvent = require('aws-event-mocks');
t event = createEvent({
mplate: 'aws:s3',
rge: {
Records: [{
eventName: 'ObjectCreated:Put',
s3: {
bucket: {
name: 'my-bucket-name'
},
object: {
key: 'object-key'
}
}
}]
t createEvent = require('aws-event-mocks');
t event = createEvent({
mplate: 'aws:scheduled',
rge: {
region: 'us-west-2'
t createEvent = require('aws-event-mocks');
t event = createEvent({
mplate: 'aws:kinesis',
rge: {
data: new Buffer('this is test data').toString('base64')