-
-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Add ZeptoMail support #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0a82d3f
Added support for ZeptoMail. Added tests.
ashish-naik 892789c
Added example to README.
ashish-naik f35372e
Added API version support.
ashish-naik c25871e
Corrected test.
ashish-naik b9ef562
Updated README and temporarily removing "npm test" from package.json …
ashish-naik b559e88
Correcting payload parameter
ashish-naik 590904a
Updated README
ashish-naik 576f059
Resolving review comments
ashish-naik 230dc2e
Resolved review comments
ashish-naik a2298ec
Removed code formatting error
ashish-naik 8474ed7
jsdoc
mtrezza a510307
jsdoc
mtrezza dfaad60
Resolved review comments
ashish-naik d70dd59
Merge branch 'main' into zeptomail
mtrezza 82aa4f8
clean-up
mtrezza 54358f3
Added test for ZeptoMail API version check
ashish-naik ce014f8
correct version chrck test
ashish-naik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -402,6 +402,54 @@ describe('ApiMailAdapter', () => { | |
expect(payload.Message.Body.Text.Data).toBe(examplePayload.text); | ||
expect(payload.Message.Body.Html.Data).toBe(examplePayload.html); | ||
}); | ||
|
||
describe('convert ZeptoMail API v1.1 payload', () => { | ||
it('converts single recipient payload', () => { | ||
const payload = converter.zeptomail({ api: '1.1', payload: examplePayload}); | ||
expect(payload.from.address).toEqual(examplePayload.from); | ||
expect(payload.to).toBeInstanceOf(Array); | ||
expect(payload.to.length).toBe(1); | ||
expect(payload.to[0].email_address.address).toEqual(examplePayload.to); | ||
expect(payload.reply_to).toBeInstanceOf(Array); | ||
expect(payload.reply_to.length).toBe(1); | ||
expect(payload.reply_to[0].address).toEqual(examplePayload.replyTo); | ||
expect(payload.subject).toBe(examplePayload.subject); | ||
expect(payload.textbody).toBe(examplePayload.text); | ||
expect(payload.htmlbody).toBe(examplePayload.html); | ||
}); | ||
|
||
it('converts multiple recipients payload', () => { | ||
const examplePayload = { | ||
from: "[email protected]", | ||
to: "[email protected],[email protected]", | ||
replyTo: "[email protected], [email protected]", | ||
subject: "ExampleSubject", | ||
text: "ExampleText", | ||
html: "ExampleHtml" | ||
} | ||
const payload = converter.zeptomail({ api: '1.1', payload: examplePayload}); | ||
expect(payload.from.address).toEqual(examplePayload.from); | ||
expect(payload.to).toBeInstanceOf(Array); | ||
const exmplePayloadToAddresses = examplePayload.to.split(','); | ||
const toAddresses = payload.to.map(entry => entry.email_address.address); | ||
exmplePayloadToAddresses.forEach((address, index) => { | ||
expect(address).toBe(toAddresses[index]); | ||
}); | ||
expect(payload.reply_to).toBeInstanceOf(Array); | ||
const exmpleReplyToAddresses = examplePayload.replyTo.split(',').map(addr => addr.trim()); | ||
const replyToAddresses = payload.reply_to[0].address.split(',').map(addr => addr.trim()); | ||
exmpleReplyToAddresses.forEach((exampleAddress, index) => { | ||
expect(replyToAddresses[index]).toBe(exampleAddress); | ||
}); | ||
expect(payload.subject).toBe(examplePayload.subject); | ||
expect(payload.textbody).toBe(examplePayload.text); | ||
expect(payload.htmlbody).toBe(examplePayload.html); | ||
}); | ||
|
||
it('throws if unsupported version', () => { | ||
expect(() => converter.zeptomail({ api: 'invalidVersion', payload: examplePayload})).toThrowError(/invalidVersion/); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('invoke _sendMail', function () { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.