@@ -469,6 +469,68 @@ describe('Sign.vue - signWithTokenCode', () => {
469469 } )
470470
471471 describe ( 'Sign.vue - API error handling' , ( ) => {
472+ it ( 'emits signed when envelope submit has mixed results and the final result is signed' , async ( ) => {
473+ const context = {
474+ loading : false ,
475+ elements : [
476+ { elementId : 101 , signRequestId : 501 , type : 'signature' } ,
477+ { elementId : 102 , signRequestId : 502 , type : 'signature' } ,
478+ ] ,
479+ canCreateSignature : false ,
480+ signRequestUuid : 'fallback-uuid' ,
481+ signatureElementsStore : {
482+ signs : { } ,
483+ } ,
484+ actionHandler : {
485+ showModal : vi . fn ( ) ,
486+ closeModal : vi . fn ( ) ,
487+ } ,
488+ signMethodsStore : {
489+ certificateEngine : 'openssl' ,
490+ } ,
491+ signStore : {
492+ document : {
493+ id : 10 ,
494+ nodeType : 'envelope' ,
495+ signers : [
496+ { me : true , signRequestId : 501 , sign_request_uuid : 'uuid-file-a' } ,
497+ { me : true , signRequestId : 502 , sign_request_uuid : 'uuid-file-b' } ,
498+ ] ,
499+ } ,
500+ clearSigningErrors : vi . fn ( ) ,
501+ setSigningErrors : vi . fn ( ) ,
502+ submitSignature : vi . fn ( )
503+ . mockResolvedValueOnce ( {
504+ status : 'signingInProgress' ,
505+ data : { } ,
506+ } )
507+ . mockResolvedValueOnce ( {
508+ status : 'signed' ,
509+ data : {
510+ action : 3500 ,
511+ } ,
512+ } ) ,
513+ } ,
514+ $emit : vi . fn ( ) ,
515+ sidebarStore : {
516+ hideSidebar : vi . fn ( ) ,
517+ } ,
518+ }
519+
520+ await submitSignatureCompatMethod . call ( context , {
521+ method : 'password' ,
522+ token : '123456' ,
523+ } )
524+
525+ expect ( context . signStore . submitSignature ) . toHaveBeenCalledTimes ( 2 )
526+ expect ( context . $emit ) . toHaveBeenCalledWith ( 'signed' , expect . objectContaining ( {
527+ action : 3500 ,
528+ signRequestUuid : 'uuid-file-a' ,
529+ } ) )
530+ expect ( context . $emit ) . not . toHaveBeenCalledWith ( 'signing-started' , expect . anything ( ) )
531+ expect ( context . loading ) . toBe ( false )
532+ } )
533+
472534 it ( 'keeps certificate validation errors in signStore and does not open certificate modal' , async ( ) => {
473535 const apiErrors = [ { message : 'Certificate has been revoked' , code : 422 } ]
474536 const context = {
0 commit comments