Skip to content

[stable32] test: add business rules coverage#6818

Merged
vitormattos merged 9 commits intostable32from
backport/6817/stable32
Feb 9, 2026
Merged

[stable32] test: add business rules coverage#6818
vitormattos merged 9 commits intostable32from
backport/6817/stable32

Conversation

@backportbot-libresign
Copy link

Backport of PR #6817

- Add comprehensive tests for getSignerLabel fallback chain
- Add tests for hasMultipleSigners detection
- Add tests for startAddingSigner validation
- Add tests for addSigner coordinate calculations
- Add tests for event handling (delete, object click)
- Add tests for cancelAdding method
- Add tests for readOnly prop behavior
- Use shared mock methods for better testability
- Ensure proper cleanup with vi.clearAllMocks

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add tests for sign button visibility logic
- Add tests for sign button variant determination
- Add tests for showAddSignersMessage conditional display
- Add tests for showVisibleElementsMessage validation
- Mock asyncReader to avoid pdfjs warnings
- Properly handle async setup in beforeEach
- Test integration with filesStore methods (canSign, canAddSigner)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add tests for showDocMdpWarning when DocMDP prevents changes
- Add tests for isOriginalFileDeleted detection
- Add tests for isEnvelope and envelopeFilesCount
- Add tests for hasSigners detection
- Add tests for showPreserveOrder with multiple signers
- Add tests for showViewOrderButton in ordered flow
- Add tests for showSaveButton and showRequestButton permission logic
- Add tests for showSigningProgress display
- Add tests for canEditSigningOrder in ordered flow
- Add tests for canDelete, canRequestSignature, canSendReminder permissions
- Add tests for canCustomizeMessage with identification methods
- Use reactive store updates via addFile for Vue 2 compatibility
- Mock router functions (generateUrl, getRootUrl) and asyncReader
- Properly align signer fixtures with component logic

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Introduce createLongPolling factory for better testability
- Add optional dependency injection for waitForFileStatusChange and sleep
- Maintain backward compatibility with existing startLongPolling API
- Allow tests to inject mock dependencies without affecting production code
- Follow Talk (spreed) testing patterns for long polling services
- Keep terminal status detection and error handling logic intact

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add tests for waitForFileStatusChange with timeout and params
- Add tests for continuous polling until status change
- Add tests for terminal status detection (stops on SIGNED, DELETED, DRAFT)
- Add tests for shouldStop callback interruption
- Add tests for onUpdate callback invocation
- Add tests for error handling and retry with backoff
- Add tests for stopping after MAX_ERRORS consecutive failures
- Add tests for onError callback invocation
- Add tests for manual polling stop via returned function
- Remove real timers to avoid slow tests
- Use console.error suppression where test-setup throws
- Inject sleep override for deterministic error backoff tests
- Avoid terminal status 1 in non-terminal polling sequences

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add tests for canSign method with various scenarios
- Add tests for canValidate when document partially or fully signed
- Add tests for canDelete permission checks
- Add tests for canAddSigner with DocMDP and deleted file validation
- Add tests for isDocMdpNoChangesAllowed detection
- Add tests for isOriginalFileDeleted metadata check
- Add tests for canSave permission logic
- Add tests for file renaming functionality
- Mock axios.patch for rename operations
- Suppress console.error in error scenarios where test-setup throws
- Test integration with currentUser and file ownership

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add array validation in hasSigners before length check
- Add array validation in isPartialSigned before filter
- Add array validation in isFullSigned before filter
- Prevent runtime errors when signers is not an array
- Improve defensive programming and robustness

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Remove debug console.error in filter_status parsing
- Keep error handling logic intact with try-catch
- Return empty array on parse failure as expected

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add Array.isArray validation in canSignerActInOrder
- Add Array.isArray validation in hasAnyDraftSigner
- Add Array.isArray validation in hasSequentialDraftSigners
- Add Array.isArray validation in hasOrderDraftSigners
- Prevent runtime errors when file.signers is not an array
- Use empty array fallback for safe array method calls
- Improve component robustness and error handling

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Feb 9, 2026
@backportbot-libresign backportbot-libresign bot added this to the Next Patch (32) milestone Feb 9, 2026
@vitormattos vitormattos merged commit 9e2e3f5 into stable32 Feb 9, 2026
60 checks passed
@vitormattos vitormattos deleted the backport/6817/stable32 branch February 9, 2026 15:29
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

1 participant

Comments