Skip to content

Commit 3e0659a

Browse files
test(signpdf): cover setSigningErrors on missing document
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent e4f1e26 commit 3e0659a

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/tests/views/SignPDF/SignPDF.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,32 @@ describe('SignPDF.vue', () => {
268268

269269
expect(wrapper.find('[data-test="pdf-editor"]').exists()).toBe(true)
270270
})
271+
272+
it('uses setSigningErrors with pdfLoad scope when document is missing', async () => {
273+
const SignPDF = (await import('../../../views/SignPDF/SignPDF.vue')).default
274+
const { useSignStore } = await import('../../../store/sign.js')
275+
const signStore = useSignStore()
276+
277+
signStore.document = undefined
278+
const setSigningErrorsSpy = vi.spyOn(signStore, 'setSigningErrors')
279+
280+
const wrapper = mount(SignPDF, {
281+
global: {
282+
stubs: {
283+
TopBar: true,
284+
NcNoteCard: true,
285+
NcButton: true,
286+
},
287+
mocks: {
288+
$route: { name: 'TestRoute', params: { uuid: 'uuid-123' }, query: {} },
289+
},
290+
},
291+
})
292+
293+
await wrapper.vm.loadPdfsFromStore()
294+
295+
expect(setSigningErrorsSpy).toHaveBeenCalledWith([
296+
{ message: 'Document not found', scope: 'pdfLoad' },
297+
])
298+
})
271299
})

0 commit comments

Comments
 (0)