File tree Expand file tree Collapse file tree
packages/email-service/src/modules/email Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ export class EmailService implements OnModuleInit {
1919 string ,
2020 EmailProto . AuthenticatedDomain [ ]
2121 > = new Map ( ) ;
22+ private testSenders : Map <
23+ string ,
24+ EmailProto . VerifiedSender [ ]
25+ > = new Map ( ) ;
2226 constructor ( @Inject ( EMAIL_DB_SERVICE_NAME ) private emailClient : ClientGrpc ) { }
2327
2428 onModuleInit ( ) {
@@ -228,6 +232,24 @@ export class EmailService implements OnModuleInit {
228232 }
229233
230234 if ( process . env [ 'NODE_ENV' ] == 'test' ) {
235+ const configKey = `${ req . configId } :${ req . configEnvironment } ` ;
236+ const senders = this . testSenders . get ( configKey ) ?? [ ] ;
237+ senders . push ( {
238+ id : senders . length ,
239+ nickname : req . nickname ?? req . fromName ,
240+ fromEmail : req . fromEmail ,
241+ fromName : req . fromName ,
242+ replyTo : req . replyTo ,
243+ address : req . address ,
244+ city : req . city ,
245+ state : req . state ,
246+ country : req . country ,
247+ zip : req . zip ,
248+ verified : false ,
249+ locked : false ,
250+ } ) ;
251+ this . testSenders . set ( configKey , senders ) ;
252+
231253 return {
232254 statusCode : 201 ,
233255 message : 'test register success' ,
@@ -349,7 +371,8 @@ export class EmailService implements OnModuleInit {
349371 }
350372
351373 if ( process . env [ 'NODE_ENV' ] == 'test' ) {
352- return { senders : [ ] } ;
374+ const configKey = `${ req . configId } :${ req . configEnvironment } ` ;
375+ return { senders : this . testSenders . get ( configKey ) ?? [ ] } ;
353376 }
354377
355378 try {
You can’t perform that action at this time.
0 commit comments