File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ class MailSlurp {
3838 mailboxes : any [ ] ;
3939 currentMailbox : any ;
4040 currentEmail : any ;
41+ useExisitngMailbox : boolean ;
4142
4243 constructor ( config : Configuration ) {
4344
@@ -61,8 +62,10 @@ class MailSlurp {
6162
6263 async _after ( ) {
6364 if ( ! this . mailboxes || ! this . mailboxes . length ) return ;
64- await Promise . all ( this . mailboxes . map ( m => this . mailslurp . deleteInbox ( m . id ) ) ) ;
65- if ( this . config . debug ) debug ( `Removed ${ this . mailboxes . length } mailboxes` ) ;
65+ if ( ! this . useExisitngMailbox ) {
66+ await Promise . all ( this . mailboxes . map ( m => this . mailslurp . deleteInbox ( m . id ) ) ) ;
67+ if ( this . config . debug ) debug ( `Removed ${ this . mailboxes . length } mailboxes` ) ;
68+ }
6669 this . mailboxes = [ ] ;
6770 this . currentMailbox = null ;
6871 this . currentEmail = null ;
@@ -110,6 +113,7 @@ class MailSlurp {
110113 inbox . toString = ( ) => inbox . emailAddress ;
111114 this . mailboxes . push ( inbox ) ;
112115 this . currentMailbox = inbox ;
116+ this . useExisitngMailbox = true ;
113117 return inbox ;
114118 }
115119
You can’t perform that action at this time.
0 commit comments