Skip to content

Commit f5bd5bc

Browse files
committed
test(SigningRequirementValidator): assert needsCreateSignature is false when no visibleElements placed
Corrects the test added in bc17180 that expected true when signerHasSignRequest was passed; that was testing the (now-removed) broken shortcut. The correct expectation is false: no placed element means the draw modal must not appear. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 6106b6e commit f5bd5bc

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/tests/services/SigningRequirementValidator.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ describe('SigningRequirementValidator', () => {
162162
expect(result).toBe(false)
163163
})
164164

165-
it('requires createSignature even when document has no placed elements but canCreateSignature is true and user is signer', () => {
166-
// When admin configures GRAPHIC_ONLY mode, canCreateSignature=true.
167-
// The signer must draw their signature even if no element box was placed on the document.
165+
it('does not require createSignature when signer has no placed visibleElements (clickToSign scenario)', () => {
166+
// Regression: signerHasSignRequest shortcut was bypassing the visibleElements check,
167+
// causing the draw modal to appear for clickToSign documents with no placed element boxes.
168168
const stores = createStores({
169169
signStore: {
170170
document: {
@@ -179,10 +179,10 @@ describe('SigningRequirementValidator', () => {
179179
stores.identificationDocumentStore,
180180
)
181181

182-
// With no placed element AND canCreateSignature=true, we still need to create the signature
183-
const result = validator.needsCreateSignature({ hasSignatures: false, canCreateSignature: true, signerHasSignRequest: true })
182+
// No placed element → should NOT require createSignature, so the sign button is reachable
183+
const result = validator.needsCreateSignature({ hasSignatures: false, canCreateSignature: true })
184184

185-
expect(result).toBe(true)
185+
expect(result).toBe(false)
186186
})
187187

188188
it('returns createSignature before clickToSign when no signature exists', () => {

0 commit comments

Comments
 (0)