Skip to content

Commit d4a8054

Browse files
committed
added mail adapter tests
1 parent fb31ffc commit d4a8054

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

spec/ApiMailAdapter.spec.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe('ApiMailAdapter', () => {
123123
}
124124
});
125125

126-
it('fails with invalid placeholder callback configuration', async () => {
126+
it('fails with invalid placeholder callback', async () => {
127127
const configs = [
128128
{ apiCallback: df, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds, placeholderCallback: {} } } },
129129
{ apiCallback: df, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds, placeholderCallback: ds } } }
@@ -133,6 +133,29 @@ describe('ApiMailAdapter', () => {
133133
}
134134
});
135135

136+
it('fails with missing or invalid API callback', async () => {
137+
const configs = [
138+
{ sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds } } },
139+
{ apiCallback: null, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds } } },
140+
{ apiCallback: true, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds } } },
141+
{ apiCallback: ds, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds } } },
142+
];
143+
for (const config of configs) {
144+
expect(adapter(config)).toThrow(Errors.Error.apiCallbackNoFunction);
145+
}
146+
});
147+
148+
it('fails with invalid locale callback', async () => {
149+
const configs = [
150+
{ apiCallback: df, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds, localeCallback: ds } } },
151+
{ apiCallback: df, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds, localeCallback: true } } },
152+
{ apiCallback: df, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds, localeCallback: [] } } },
153+
];
154+
for (const config of configs) {
155+
expect(adapter(config)).toThrow(Errors.Error.localeCallbackNoFunction);
156+
}
157+
});
158+
136159
it('succeeds with valid configuration', async () => {
137160
const configs = [
138161
{ apiCallback: df, sender: ds, templates: { customEmail: { subjectPath: ds, textPath: ds } } },

0 commit comments

Comments
 (0)