Skip to content

Commit 3991e6b

Browse files
test: cover malformed optional fields in validation payload
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 768c2bc commit 3991e6b

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

src/tests/views/Validation.spec.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,5 +1047,39 @@ describe('Validation.vue - Business Logic', () => {
10471047
expect(wrapper.vm.document).toBe(null)
10481048
expect(wrapper.vm.validationErrorMessage).toBe('Failed to validate document')
10491049
})
1050+
1051+
it('rejects document payload when metadata dimensions are malformed', () => {
1052+
wrapper.vm.handleValidationSuccess(createLoadedValidationDocument({
1053+
metadata: {
1054+
extension: 'pdf',
1055+
p: 1,
1056+
d: [{ w: '100', h: 200 }],
1057+
},
1058+
}))
1059+
1060+
expect(wrapper.vm.document).toBe(null)
1061+
expect(wrapper.vm.validationErrorMessage).toBe('Failed to validate document')
1062+
})
1063+
1064+
it('rejects document payload when signer extended validation fields have invalid types', () => {
1065+
wrapper.vm.handleValidationSuccess(createLoadedValidationDocument({
1066+
signers: [{
1067+
signRequestId: 1,
1068+
displayName: 'Signer',
1069+
email: 'signer@example.com',
1070+
signed: null,
1071+
status: 1,
1072+
statusText: 'Pending',
1073+
description: null,
1074+
request_sign_date: '2026-01-01T00:00:00Z',
1075+
me: false,
1076+
visibleElements: [],
1077+
signature_validation: { id: '1', label: 'Valid' },
1078+
}],
1079+
}))
1080+
1081+
expect(wrapper.vm.document).toBe(null)
1082+
expect(wrapper.vm.validationErrorMessage).toBe('Failed to validate document')
1083+
})
10501084
})
10511085
})

0 commit comments

Comments
 (0)