Skip to content

Commit 15e93ca

Browse files
authored
feat: sparkpost options (#92)
1 parent 7408188 commit 15e93ca

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

schemas/common-mailer.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,18 @@
9999
}
100100
},
101101
"then": {
102-
"required": ["sparkPostApiKey"]
102+
"required": ["sparkPostApiKey"],
103+
"properties": {
104+
"options": {
105+
"type": "object",
106+
"additionalProperties": false,
107+
"properties": {
108+
"transactional": {
109+
"type": "boolean"
110+
}
111+
}
112+
}
113+
}
103114
},
104115
"else": {
105116
"if": {

test/helpers.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ exports.VALID_PREDEFINED_ACCOUNTS = {
122122
},
123123
};
124124

125+
exports.TEST_SPARKPOST_OPTIONS = {
126+
sparkpost: {
127+
transport: 'sparkpost',
128+
sparkPostApiKey: 'invalidkey',
129+
options: {
130+
transactional: true,
131+
},
132+
},
133+
};
134+
125135
exports.TEST_EMAIL = {
126136
to: 'v@makeomatic.ru',
127137
html: 'very important stuff',

test/suites/ms-mailer.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,23 @@ describe('MS Mailer', function AMQPTransportTestSuite() {
4343
});
4444
});
4545

46+
it('is able to setup transports with options', function test() {
47+
mailer = new Mailer({
48+
accounts: smtp.TEST_SPARKPOST_OPTIONS,
49+
amqp: smtp.AMQPConfiguration,
50+
});
51+
52+
return mailer
53+
.connect()
54+
.then(() => {
55+
assert.equal(
56+
mailer._transports.get('sparkpost').transporter.options.transactional,
57+
true
58+
)
59+
return null;
60+
});
61+
});
62+
4663
afterEach(async function clean() {
4764
return mailer && mailer.close();
4865
});

0 commit comments

Comments
 (0)