@@ -627,26 +627,36 @@ describe('MessageComposer', () => {
627627 } ) ;
628628
629629 describe ( 'offlineDB enabled' , ( ) => {
630- it ( 'hasSendableData should return false if the composition is empty' , ( ) => {
631- const { messageComposer } = offlineModeMessageComposerSetup ( ) ;
630+ it ( 'hasSendableData should return true if the composition is not empty' , ( ) => {
631+ const { messageComposer } = offlineModeMessageComposerSetup ( {
632+ composition : {
633+ id : 'test-message-id' ,
634+ type : 'regular' ,
635+ text : 'Hello' ,
636+ } ,
637+ } ) ;
632638
633- const spyCompositionIsEmpty = vi
634- . spyOn ( messageComposer , 'compositionIsEmpty' , 'get' )
635- . mockReturnValue ( true ) ;
639+ expect ( messageComposer . hasSendableData ) . toBe ( true ) ;
640+ } ) ;
636641
637- expect ( messageComposer . hasSendableData ) . toBe ( false ) ;
638- spyCompositionIsEmpty . mockRestore ( ) ;
642+ it ( 'hasSendableData should return true if the composition is not empty with attachments' , ( ) => {
643+ const { messageComposer } = offlineModeMessageComposerSetup ( {
644+ composition : {
645+ id : 'test-message-id' ,
646+ type : 'regular' ,
647+ attachments : [
648+ { type : 'x' , localMetadata : { id : 'x,' , uploadState : 'finished' , file : { } } } ,
649+ ] ,
650+ } ,
651+ } ) ;
652+
653+ expect ( messageComposer . hasSendableData ) . toBe ( true ) ;
639654 } ) ;
640655
641- it ( 'hasSendableData should return true if the composition is not empty' , ( ) => {
656+ it ( 'hasSendableData should return false if the composition is empty' , ( ) => {
642657 const { messageComposer } = offlineModeMessageComposerSetup ( ) ;
643658
644- const spyCompositionIsEmpty = vi
645- . spyOn ( messageComposer , 'compositionIsEmpty' , 'get' )
646- . mockReturnValue ( false ) ;
647-
648- expect ( messageComposer . hasSendableData ) . toBe ( true ) ;
649- spyCompositionIsEmpty . mockRestore ( ) ;
659+ expect ( messageComposer . hasSendableData ) . toBe ( false ) ;
650660 } ) ;
651661 } ) ;
652662
0 commit comments