@@ -646,11 +646,63 @@ describe('Validation.vue - Business Logic', () => {
646646 describe ( 'handleValidationSuccess - confetti behavior' , ( ) => {
647647 // FILE_STATUS.SIGNED = 3
648648 const SIGNED_STATUS = 3
649+ const createSignerDetail = ( patch : Record < string , unknown > = { } ) => ( {
650+ signRequestId : 1 ,
651+ displayName : 'Signer' ,
652+ email : 'signer@example.com' ,
653+ signed : null ,
654+ status : 0 ,
655+ statusText : 'Pending' ,
656+ description : null ,
657+ request_sign_date : '2026-01-01T00:00:00Z' ,
658+ me : false ,
659+ visibleElements : [ ] ,
660+ ...patch ,
661+ } )
662+ const createChildFile = ( patch : Record < string , unknown > = { } ) => ( {
663+ id : 201 ,
664+ uuid : 'child-1' ,
665+ name : 'child-1.pdf' ,
666+ status : 1 ,
667+ statusText : 'Pending' ,
668+ nodeId : 201 ,
669+ totalPages : 1 ,
670+ size : 10 ,
671+ pdfVersion : '1.7' ,
672+ signers : [ ] ,
673+ file : '/apps/libresign/p/pdf/child-1' ,
674+ metadata : { extension : 'pdf' , p : 1 } ,
675+ ...patch ,
676+ } )
649677 const createLoadedValidationDocument = ( patch : Record < string , unknown > = { } ) => ( {
678+ id : 100 ,
650679 uuid : '550e8400-e29b-41d4-a716-446655440000' ,
651680 name : 'contract.pdf' ,
681+ statusText : 'Pending' ,
652682 nodeId : 100 ,
653683 nodeType : 'file' ,
684+ signatureFlow : 0 ,
685+ docmdpLevel : 0 ,
686+ filesCount : 1 ,
687+ files : [ {
688+ id : 100 ,
689+ uuid : '550e8400-e29b-41d4-a716-446655440000' ,
690+ name : 'contract.pdf' ,
691+ status : 1 ,
692+ statusText : 'Pending' ,
693+ nodeId : 100 ,
694+ totalPages : 1 ,
695+ size : 10 ,
696+ pdfVersion : '1.7' ,
697+ signers : [ ] ,
698+ file : '/apps/libresign/p/pdf/550e8400-e29b-41d4-a716-446655440000' ,
699+ metadata : { extension : 'pdf' , p : 1 } ,
700+ } ] ,
701+ totalPages : 1 ,
702+ size : 10 ,
703+ pdfVersion : '1.7' ,
704+ created_at : '2026-01-01T00:00:00Z' ,
705+ requested_by : { userId : 'creator-user' , displayName : 'Creator User' } ,
654706 status : 1 ,
655707 signers : [ ] ,
656708 ...patch ,
@@ -673,9 +725,10 @@ describe('Validation.vue - Business Logic', () => {
673725 wrapper . vm . handleValidationSuccess ( createLoadedValidationDocument ( {
674726 nodeType : 'envelope' ,
675727 status : 0 ,
728+ filesCount : 2 ,
676729 files : [
677- { status : SIGNED_STATUS } ,
678- { status : SIGNED_STATUS } ,
730+ createChildFile ( { id : 201 , uuid : 'child-1' , nodeId : 201 , status : SIGNED_STATUS , statusText : 'Signed' } ) ,
731+ createChildFile ( { id : 202 , uuid : 'child-2' , nodeId : 202 , status : SIGNED_STATUS , statusText : 'Signed' , file : '/apps/libresign/p/pdf/child-2' , name : 'child-2.pdf' } ) ,
679732 ] ,
680733 } ) )
681734 expect ( mockAddConfetti ) . toHaveBeenCalledOnce ( )
@@ -686,7 +739,7 @@ describe('Validation.vue - Business Logic', () => {
686739 // SIGN_REQUEST_STATUS.SIGNED = 2
687740 wrapper . vm . handleValidationSuccess ( createLoadedValidationDocument ( {
688741 status : 0 ,
689- signers : [ { me : true , status : 2 } ] ,
742+ signers : [ createSignerDetail ( { me : true , status : 2 } ) ] ,
690743 } ) )
691744 expect ( mockAddConfetti ) . toHaveBeenCalledOnce ( )
692745 } )
@@ -776,9 +829,10 @@ describe('Validation.vue - Business Logic', () => {
776829 wrapper . vm . handleValidationSuccess ( createLoadedValidationDocument ( {
777830 nodeType : 'envelope' ,
778831 status : 0 ,
832+ filesCount : 2 ,
779833 files : [
780- { id : 201 , uuid : 'child-1' , nodeId : 201 , name : 'child-1.pdf' , status : SIGNED_STATUS } ,
781- { id : 202 , uuid : 'child-2' , nodeId : 202 , name : ' child-2.pdf ', status : SIGNED_STATUS } ,
834+ createChildFile ( { id : 201 , uuid : 'child-1' , nodeId : 201 , status : SIGNED_STATUS , statusText : 'Signed' } ) ,
835+ createChildFile ( { id : 202 , uuid : 'child-2' , nodeId : 202 , status : SIGNED_STATUS , statusText : 'Signed' , file : '/apps/libresign/p/pdf/ child-2', name : 'child-2.pdf' } ) ,
782836 ] ,
783837 } ) )
784838
@@ -803,11 +857,48 @@ describe('Validation.vue - Business Logic', () => {
803857 const SIGNED_STATUS = 3
804858 // SIGN_REQUEST_STATUS.SIGNED = 2
805859 const SIGNER_SIGNED_STATUS = 2
860+ const createSignerDetail = ( patch : Record < string , unknown > = { } ) => ( {
861+ signRequestId : 1 ,
862+ displayName : 'Signer' ,
863+ email : 'signer@example.com' ,
864+ signed : null ,
865+ status : 0 ,
866+ statusText : 'Pending' ,
867+ description : null ,
868+ request_sign_date : '2026-01-01T00:00:00Z' ,
869+ me : false ,
870+ visibleElements : [ ] ,
871+ ...patch ,
872+ } )
806873 const createLoadedValidationDocument = ( patch : Record < string , unknown > = { } ) => ( {
874+ id : 100 ,
807875 uuid : '550e8400-e29b-41d4-a716-446655440000' ,
808876 name : 'contract.pdf' ,
877+ statusText : 'Pending' ,
809878 nodeId : 100 ,
810879 nodeType : 'file' ,
880+ signatureFlow : 0 ,
881+ docmdpLevel : 0 ,
882+ filesCount : 1 ,
883+ files : [ {
884+ id : 100 ,
885+ uuid : '550e8400-e29b-41d4-a716-446655440000' ,
886+ name : 'contract.pdf' ,
887+ status : 1 ,
888+ statusText : 'Pending' ,
889+ nodeId : 100 ,
890+ totalPages : 1 ,
891+ size : 10 ,
892+ pdfVersion : '1.7' ,
893+ signers : [ ] ,
894+ file : '/apps/libresign/p/pdf/550e8400-e29b-41d4-a716-446655440000' ,
895+ metadata : { extension : 'pdf' , p : 1 } ,
896+ } ] ,
897+ totalPages : 1 ,
898+ size : 10 ,
899+ pdfVersion : '1.7' ,
900+ created_at : '2026-01-01T00:00:00Z' ,
901+ requested_by : { userId : 'creator-user' , displayName : 'Creator User' } ,
811902 status : 1 ,
812903 signers : [ ] ,
813904 ...patch ,
@@ -844,7 +935,7 @@ describe('Validation.vue - Business Logic', () => {
844935 it ( 'fires confetti when the current signer is marked as signed' , ( ) => {
845936 const fileWithSignedSigner = createLoadedValidationDocument ( {
846937 status : 1 ,
847- signers : [ { me : true , status : SIGNER_SIGNED_STATUS , signed : '2025-01-01T00:00:00Z' } ] ,
938+ signers : [ createSignerDetail ( { me : true , status : SIGNER_SIGNED_STATUS , signed : '2025-01-01T00:00:00Z' } ) ] ,
848939 } )
849940 wrapper . vm . handleSigningComplete ( fileWithSignedSigner )
850941 expect ( mockAddConfetti ) . toHaveBeenCalledOnce ( )
@@ -853,7 +944,7 @@ describe('Validation.vue - Business Logic', () => {
853944 it ( 'does not fire confetti when the file is not yet signed and no signer is marked as signed' , ( ) => {
854945 // This is a realistic scenario: SigningProgress emits 'completed'
855946 // with a file object whose status is still pending/partial
856- const unsignedFile = createLoadedValidationDocument ( { status : 1 , signers : [ { me : true , status : 0 } ] } )
947+ const unsignedFile = createLoadedValidationDocument ( { status : 1 , signers : [ createSignerDetail ( { me : true , status : 0 } ) ] } )
857948 wrapper . vm . handleSigningComplete ( unsignedFile )
858949 expect ( mockAddConfetti ) . not . toHaveBeenCalled ( )
859950 } )
@@ -881,7 +972,7 @@ describe('Validation.vue - Business Logic', () => {
881972 ocs : {
882973 data : createLoadedValidationDocument ( {
883974 status : 1 ,
884- signers : [ { me : true , status : SIGNER_SIGNED_STATUS , signed : '2025-01-01T00:00:00Z' } ] ,
975+ signers : [ createSignerDetail ( { me : true , status : SIGNER_SIGNED_STATUS , signed : '2025-01-01T00:00:00Z' } ) ] ,
885976 } ) ,
886977 } ,
887978 } ,
0 commit comments