@@ -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