File tree Expand file tree Collapse file tree 2 files changed +32
-7
lines changed Expand file tree Collapse file tree 2 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -572,6 +572,35 @@ describe('browserbox unit tests', () => {
572572 } )
573573 } )
574574
575+ describe ( '#deleteMailbox' , ( ) => {
576+ beforeEach ( ( ) => {
577+ sinon . stub ( br , 'exec' )
578+ } )
579+
580+ it ( 'should call DELETE with a string payload' , ( ) => {
581+ br . exec . withArgs ( {
582+ command : 'DELETE' ,
583+ attributes : [ 'mailboxname' ]
584+ } ) . returns ( Promise . resolve ( ) )
585+
586+ return br . deleteMailbox ( 'mailboxname' ) . then ( ( ) => {
587+ expect ( br . exec . callCount ) . to . equal ( 1 )
588+ } )
589+ } )
590+
591+ it ( 'should call mutf7 encode the argument' , ( ) => {
592+ // From RFC 3501
593+ br . exec . withArgs ( {
594+ command : 'DELETE' ,
595+ attributes : [ '~peter/mail/&U,BTFw-/&ZeVnLIqe-' ]
596+ } ) . returns ( Promise . resolve ( ) )
597+
598+ return br . deleteMailbox ( '~peter/mail/\u53f0\u5317/\u65e5\u672c\u8a9e' ) . then ( ( ) => {
599+ expect ( br . exec . callCount ) . to . equal ( 1 )
600+ } )
601+ } )
602+ } )
603+
575604 describe . skip ( '#listMessages' , ( ) => {
576605 beforeEach ( ( ) => {
577606 sinon . stub ( br , 'exec' )
Original file line number Diff line number Diff line change @@ -359,7 +359,7 @@ export default class Client {
359359 }
360360 }
361361
362- /**
362+ /**
363363 * Delete a mailbox with the given path.
364364 *
365365 * DELETE details:
@@ -371,13 +371,9 @@ export default class Client {
371371 * @returns {Promise }
372372 * Promise resolves if mailbox was deleted.
373373 */
374- async createMailbox ( path ) {
374+ deleteMailbox ( path ) {
375375 this . logger . debug ( 'Deleting mailbox' , path , '...' )
376- try {
377- await this . exec ( { command : 'DELETE' , attributes : [ imapEncode ( path ) ] } )
378- } catch ( err ) {
379- throw err
380- }
376+ return this . exec ( { command : 'DELETE' , attributes : [ imapEncode ( path ) ] } )
381377 }
382378
383379 /**
You can’t perform that action at this time.
0 commit comments