Skip to content

Commit 30fec69

Browse files
committed
test: use openapi validation file fixtures
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 23aa97a commit 30fec69

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

src/tests/components/validation/FileValidation.spec.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
77
import { mount } from '@vue/test-utils'
88
import type { VueWrapper } from '@vue/test-utils'
9+
import type { LoadedValidationFileDocument } from '../../../types/index'
910

1011
type FileValidationComponent = typeof import('../../../components/validation/FileValidation.vue').default
1112
type FileValidationWrapper = VueWrapper<any>
12-
type FileValidationDocument = {
13-
uuid: string
14-
name: string
15-
nodeId: number
16-
nodeType: 'file'
17-
status: 0 | 1 | 2 | 3 | 4 | string
18-
[key: string]: unknown
19-
}
2013
type WrapperProps = {
21-
document?: Partial<FileValidationDocument>
14+
document?: Record<string, unknown>
2215
legalInformation?: string
2316
documentValidMessage?: string | null
2417
isAfterSigned?: boolean
@@ -46,21 +39,33 @@ describe('FileValidation', () => {
4639

4740
const createWrapper = (props: WrapperProps = {}) => {
4841
const { document: documentOverrides, ...restProps } = props
49-
const baseDocument: FileValidationDocument = {
42+
const baseDocument: LoadedValidationFileDocument = {
43+
id: 1,
5044
uuid: '550e8400-e29b-41d4-a716-446655440000',
5145
name: 'Test Document',
46+
statusText: 'Pending',
5247
nodeId: 123,
5348
nodeType: 'file',
49+
signatureFlow: 0,
50+
docmdpLevel: 0,
51+
totalPages: 1,
5452
status: 1,
53+
size: 0,
54+
pdfVersion: '1.7',
55+
created_at: '2026-01-01 00:00:00',
56+
requested_by: {
57+
userId: 'requester',
58+
displayName: 'Requester',
59+
},
5560
}
56-
const document = { ...baseDocument, ...(documentOverrides ?? {}) } as FileValidationDocument
61+
const document = { ...baseDocument, ...(documentOverrides ?? {}) }
5762
return mount(FileValidation, {
5863
props: {
5964
legalInformation: '',
6065
documentValidMessage: '',
6166
isAfterSigned: false,
6267
...restProps,
63-
document,
68+
document: document as never,
6469
},
6570
global: {
6671
stubs: {
@@ -214,7 +219,7 @@ describe('FileValidation', () => {
214219
it('passes document prop', () => {
215220
const doc = {
216221
name: 'Important.pdf',
217-
status: '3',
222+
status: 3,
218223
}
219224
wrapper = createWrapper({
220225
document: doc,
@@ -313,7 +318,7 @@ describe('FileValidation', () => {
313318
wrapper = createWrapper({
314319
document: {
315320
name: 'Doc.pdf',
316-
status: '3',
321+
status: 3,
317322
},
318323
})
319324

@@ -325,7 +330,7 @@ describe('FileValidation', () => {
325330
name: 'complex.pdf',
326331
status: '3',
327332
totalPages: 50,
328-
size: '5242880',
333+
size: 5242880,
329334
pdfVersion: '1.7',
330335
uuid: 'uuid-123',
331336
signers: [

0 commit comments

Comments
 (0)