-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "feat: export SMTP transport options of
nodemailer
"" (…
- Loading branch information
1 parent
2627bcf
commit d1bf2de
Showing
7 changed files
with
150 additions
and
35 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sap-cloud-sdk/mail-client': minor | ||
--- | ||
|
||
[New Functionality] Expose SMTP transport options of `nodemailer`. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import nodemailer from 'nodemailer'; | ||
import { SocksClient } from 'socks'; | ||
import { Protocol } from '@sap-cloud-sdk/connectivity'; | ||
import { buildSocksProxy, sendMail } from './mail-client'; | ||
import { MailDestination, MailConfig } from './mail-client-types'; | ||
import { | ||
buildSocksProxy, | ||
isMailSentInSequential, | ||
sendMail | ||
} from './mail-client'; | ||
import { | ||
MailDestination, | ||
MailConfig, | ||
MailClientOptions | ||
} from './mail-client-types'; | ||
|
||
describe('mail client', () => { | ||
beforeEach(() => { | ||
|
@@ -94,7 +102,7 @@ describe('mail client', () => { | |
to: '[email protected]' | ||
}; | ||
await expect( | ||
sendMail(destination, mailOptions, { parallel: false }) | ||
sendMail(destination, mailOptions, { sdkOptions: { parallel: false } }) | ||
).resolves.not.toThrow(); | ||
expect(spyCreateSocket).toBeCalledTimes(1); | ||
expect(spyCreateTransport).toBeCalledTimes(1); | ||
|
@@ -106,6 +114,36 @@ describe('mail client', () => { | |
}); | ||
}); | ||
|
||
describe('isMailSentInSequential', () => { | ||
it('should return false when the mail client options is undefined', () => { | ||
expect(isMailSentInSequential()).toBe(false); | ||
}); | ||
|
||
it('should return false when the sdk options is undefined', () => { | ||
const mailClientOptions: MailClientOptions = {}; | ||
expect(isMailSentInSequential(mailClientOptions)).toBe(false); | ||
}); | ||
|
||
it('should return false when the parallel option is undefined', () => { | ||
const mailClientOptions: MailClientOptions = { sdkOptions: {} }; | ||
expect(isMailSentInSequential(mailClientOptions)).toBe(false); | ||
}); | ||
|
||
it('should return false when the parallel option is set to true', () => { | ||
const mailClientOptions: MailClientOptions = { | ||
sdkOptions: { parallel: true } | ||
}; | ||
expect(isMailSentInSequential(mailClientOptions)).toBe(false); | ||
}); | ||
|
||
it('should return true when the parallel option is set to false', () => { | ||
const mailClientOptions: MailClientOptions = { | ||
sdkOptions: { parallel: false } | ||
}; | ||
expect(isMailSentInSequential(mailClientOptions)).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('buildSocksProxy', () => { | ||
it('build valid socks proxy', () => { | ||
const dest: MailDestination = { | ||
|
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