Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions src/tests/views/Validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,69 @@ describe('Validation.vue - Business Logic', () => {
})
})

it('shows info when nobody has signed yet', () => {
expect(wrapper.vm.getDocumentValidationSummary({
signers: [
{ signed: null },
{ signed: null },
],
files: [],
})).toEqual({
message: 'No digital signatures were found in this document',
type: 'info',
})
})

it('shows info for an envelope where nobody has signed', () => {
expect(wrapper.vm.getDocumentValidationSummary({
signers: [{ signed: null }],
files: [
{ signers: [{ signed: null }] },
{ signers: [{ signed: null }] },
],
})).toEqual({
message: 'No digital signatures were found in this document',
type: 'info',
})
})

it('evaluates only the signers who have signed', () => {
expect(wrapper.vm.getDocumentValidationSummary({
signers: [
{
signed: '2026-10-01T12:00:00+00:00',
signature_validation: { id: 1 },
document_modification_state: 'unchanged',
},
{ signed: null, modifications: { modified: true } },
],
files: [],
})).toEqual({
message: 'This document is valid',
type: 'success',
})
})

it('treats a signer with a signing date as signed even without cryptographic details', () => {
expect(wrapper.vm.getDocumentValidationSummary({
signers: [{ signed: '2026-10-01T12:00:00+00:00' }],
files: [],
})).toEqual({
message: 'This document is valid',
type: 'success',
})
})

it('treats a signer with the signed status as signed even without a signing date', () => {
expect(wrapper.vm.getDocumentValidationSummary({
signers: [{ status: 2 }],
files: [],
})).toEqual({
message: 'This document is valid',
type: 'success',
})
})

it('shows warning when the document was modified after signing', () => {
expect(wrapper.vm.getDocumentValidationSummary({
signers: [{
Expand Down
8 changes: 7 additions & 1 deletion src/views/Validation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,14 @@ function getValidationDocumentSigners(validationDocument: ValidationDocumentStat
return signers
}

function hasAppliedSignature(signer: ValidationDisplaySigner) {
return Boolean(signer.signed)
|| Number(signer.status) === SIGN_REQUEST_STATUS.SIGNED
|| signer.signature_validation !== undefined
}

function getDocumentValidationSummary(validationDocument: ValidationDocumentState): DocumentValidationSummary {
const signers = getValidationDocumentSigners(validationDocument)
const signers = getValidationDocumentSigners(validationDocument).filter(hasAppliedSignature)

if (signers.length === 0) {
return {
Expand Down
Loading