diff --git a/vigilcare-records-web/src/__tests__/components/ApprovalForm.test.ts b/vigilcare-records-web/src/__tests__/components/ApprovalForm.test.ts new file mode 100644 index 0000000..aff4067 --- /dev/null +++ b/vigilcare-records-web/src/__tests__/components/ApprovalForm.test.ts @@ -0,0 +1,224 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { mount, flushPromises } from '@vue/test-utils' +import { setActivePinia, createPinia } from 'pinia' +import ApprovalForm from '@/components/ApprovalForm.vue' +import { useBatchStore } from '@/stores/batches' +import type { BatchDetailResponse } from '@/types' +import { + emptyDraft, + fieldRequirementsForBatchType, +} from '@/__tests__/helpers/fieldRequirements' + +vi.mock('@/api/client', () => ({ + get: vi.fn(), + post: vi.fn(), + put: vi.fn(), + del: vi.fn(), + patch: vi.fn(), + uploadFile: vi.fn(), +})) + +vi.mock('@/composables/useToast', () => ({ + useToast: () => ({ + success: vi.fn(), + error: vi.fn(), + warning: vi.fn(), + info: vi.fn(), + }), +})) + +const mountOptions = { + global: { + stubs: { + Teleport: { template: '
+ + Verified draft +
++ Clinical sign-off before promotion to live clinical tables. Review the source scan and verified draft. +
+Correction Batch
++ This batch corrects and will supersede batch + {{ batch.supersedesBatchId.substring(0, 8) }}... +
+ ++ + High-stakes clinical signals +
+{{ item.value }}
+{{ item.reason }}
+{{ batch.verifiedByUserId.substring(0, 8) }}…
++ + Clinical decision +
+ ++ + Promotion outcome +
+Promoted to live clinical tables
+Approved — Promotion Deferred
++ Promotion will be retried automatically due to a temporary infrastructure issue. +
+