-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
29 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -34,19 +34,23 @@ describe('MailService', () => { | |
expect(service).toBeDefined(); | ||
}); | ||
|
||
it('should send given data to queue', async () => { | ||
const data: Mail = { mail: { plainTextContent: 'content', subject: 'Test' }, recipients: ['[email protected]'] }; | ||
const amqpConnectionSpy = jest.spyOn(amqpConnection, 'publish'); | ||
describe('send', () => { | ||
describe('when recipients array is empty', () => { | ||
it('should not send email)', async () => { | ||
const data: Mail = { | ||
mail: { plainTextContent: 'content', subject: 'Test' }, | ||
recipients: ['[email protected]'], | ||
}; | ||
|
||
await service.send(data); | ||
const amqpConnectionSpy = jest.spyOn(amqpConnection, 'publish'); | ||
|
||
const expectedParams = [mailServiceOptions.exchange, mailServiceOptions.routingKey, data, { persistent: true }]; | ||
expect(amqpConnectionSpy).toHaveBeenCalledWith(...expectedParams); | ||
}); | ||
await service.send(data); | ||
|
||
describe('send', () => { | ||
expect(amqpConnectionSpy).toHaveBeenCalledTimes(0); | ||
}); | ||
}); | ||
describe('when sending email', () => { | ||
it('should remove email address that have blacklisted domain', async () => { | ||
it('should remove email address that have blacklisted domain and send given data to queue', async () => { | ||
const data: Mail = { | ||
mail: { plainTextContent: 'content', subject: 'Test' }, | ||
recipients: ['[email protected]', '[email protected]', '[email protected]', '[email protected]'], | ||
|
This file contains 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 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 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 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 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 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 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 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 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 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