https://github.com/ert78gb/aws-ses-localstack-test
Test util for AWS Simple Email Service testion via Localstack
https://github.com/ert78gb/aws-ses-localstack-test
Last synced: 8 days ago
JSON representation
Test util for AWS Simple Email Service testion via Localstack
- Host: GitHub
- URL: https://github.com/ert78gb/aws-ses-localstack-test
- Owner: ert78gb
- Created: 2023-01-11T15:44:39.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-08T10:31:53.000Z (about 1 year ago)
- Last Synced: 2024-04-14T07:26:55.439Z (about 1 year ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
AWS SES Localstack test util
============================This package provides the following methods to help with integration or e2e tests
- `getEmails` returns with all emails from the localstack mounted volumes
- `deleteEmails` deletes all emails from the localstack mounted volumes## How to use
Query all emails.
```javascript
import { getEmails } from '@ert78gb/aws-ses-localstack-test'const sentEmails = getEmails({
baseUrl: 'http://localhost:4566/', // URI of the localstack instance
})
```Query emails by id. Logically should return only 1 email, but who knows, so the result is an array
```javascript
import { getEmails } from '@ert78gb/aws-ses-localstack-test'const sentEmails = getEmails({baseUrl: 'http://localhost:4566/', id: 'message-id'})
```Query emails by sender/source
```javascript
import { getEmails } from '@ert78gb/aws-ses-localstack-test'const sentEmails = getEmails({baseUrl: 'http://localhost:4566/', source: '[email protected]'})
```Sent email structure. Uses the original property names as localstack generates the json files
```typescript
interface LocalstackEmail {
Id: string;
Region: string;
Destination: {
BccAddresses?: string[];
CcAddresses?: string[];
ToAddresses?: string[];
},
Source: string;
Subject: string;
Body: {
text_part: string;
html_part: string;
},
Timestamp: Date;
}
```
Delete all emails```javascript
import { deleteEmails } from '@ert78gb/aws-ses-localstack-test'const sentEmails = deleteEmails({baseUrl: 'http://localhost:4566/'})
```Delete email by id
```javascript
import { deleteEmails } from '@ert78gb/aws-ses-localstack-test'const sentEmails = deleteEmails({baseUrl: 'http://localhost:4566/', id: 'message-id'})
```