fix frontend issues
CI / backend (push) Successful in 6m10s
CI / frontend (push) Successful in 55s

This commit is contained in:
voltsrage
2026-08-11 20:54:59 +08:00
parent f2eab26ad0
commit e25b57c779
9 changed files with 16 additions and 68 deletions
-30
View File
@@ -579,9 +579,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -599,9 +596,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -619,9 +613,6 @@
"ppc64" "ppc64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -639,9 +630,6 @@
"s390x" "s390x"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -659,9 +647,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -679,9 +664,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2509,9 +2491,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2533,9 +2512,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2557,9 +2533,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2581,9 +2554,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -107,7 +107,6 @@ describe('EntryForm', () => {
const wrapper = mount(EntryForm, { const wrapper = mount(EntryForm, {
props: { batch: makeBatch(), batchId: 'b1' }, props: { batch: makeBatch(), batchId: 'b1' },
}) })
const submitBtn = wrapper.find('button')
const buttons = wrapper.findAll('button') const buttons = wrapper.findAll('button')
const submitButton = buttons.find((b) => b.text().includes('Submit for Verification')) const submitButton = buttons.find((b) => b.text().includes('Submit for Verification'))
expect(submitButton).toBeTruthy() expect(submitButton).toBeTruthy()
@@ -172,7 +171,6 @@ describe('EntryForm', () => {
store.currentDraft = emptyDraft('VITALS', { store.currentDraft = emptyDraft('VITALS', {
patient: { patient: {
id: 'dp1', id: 'dp1',
batchId: 'b1',
fullName: 'John Doe', fullName: 'John Doe',
dateOfBirth: '1990-05-15', dateOfBirth: '1990-05-15',
sex: 'male', sex: 'male',
@@ -188,7 +186,7 @@ describe('EntryForm', () => {
}) })
await wrapper.vm.$nextTick() await wrapper.vm.$nextTick()
const nameInput = wrapper.find('input[type="text"]') const nameInput = wrapper.find<HTMLInputElement>('input[type="text"]')
expect(nameInput.element.value).toBe('John Doe') expect(nameInput.element.value).toBe('John Doe')
}) })
}) })
@@ -271,7 +269,7 @@ describe('EntryForm', () => {
const store = useBatchStore() const store = useBatchStore()
store.submitForVerification = vi.fn().mockReturnValue( store.submitForVerification = vi.fn().mockReturnValue(
new Promise((resolve) => { new Promise<void>((resolve) => {
resolvePromise = resolve resolvePromise = resolve
}), }),
) )
@@ -21,7 +21,7 @@ describe('ObservationRow', () => {
const wrapper = mount(ObservationRow, { const wrapper = mount(ObservationRow, {
props: { observation: makeObservation() }, props: { observation: makeObservation() },
}) })
const options = wrapper.findAll('select option') const options = wrapper.findAll<HTMLOptionElement>('select option')
const values = options.map((o) => o.element.value) const values = options.map((o) => o.element.value)
expect(values).toContain('HEART_RATE') expect(values).toContain('HEART_RATE')
expect(values).toContain('TEMP_C') expect(values).toContain('TEMP_C')
@@ -34,10 +34,10 @@ describe('ObservationRow', () => {
const wrapper = mount(ObservationRow, { const wrapper = mount(ObservationRow, {
props: { observation: makeObservation({ value: 98.6, unit: '°F' }) }, props: { observation: makeObservation({ value: 98.6, unit: '°F' }) },
}) })
const numberInput = wrapper.find('input[type="number"]') const numberInput = wrapper.find<HTMLInputElement>('input[type="number"]')
expect(numberInput.element.value).toBe('98.6') expect(numberInput.element.value).toBe('98.6')
const textInputs = wrapper.findAll('input[type="text"]') const textInputs = wrapper.findAll<HTMLInputElement>('input[type="text"]')
const unitInput = textInputs[0] const unitInput = textInputs[0]
expect(unitInput.element.value).toBe('°F') expect(unitInput.element.value).toBe('°F')
}) })
@@ -93,7 +93,7 @@ describe('ObservationRow', () => {
const select = wrapper.find('select') const select = wrapper.find('select')
expect(select.element.disabled).toBe(true) expect(select.element.disabled).toBe(true)
const numberInput = wrapper.find('input[type="number"]') const numberInput = wrapper.find<HTMLInputElement>('input[type="number"]')
expect(numberInput.element.disabled).toBe(true) expect(numberInput.element.disabled).toBe(true)
}) })
@@ -114,7 +114,7 @@ describe('ObservationRow', () => {
verified: false, verified: false,
}, },
}) })
const checkbox = wrapper.find('input[type="checkbox"]') const checkbox = wrapper.find<HTMLInputElement>('input[type="checkbox"]')
expect(checkbox.exists()).toBe(true) expect(checkbox.exists()).toBe(true)
expect(checkbox.element.checked).toBe(false) expect(checkbox.element.checked).toBe(false)
}) })
@@ -128,7 +128,7 @@ describe('ObservationRow', () => {
verified: true, verified: true,
}, },
}) })
const checkbox = wrapper.find('input[type="checkbox"]') const checkbox = wrapper.find<HTMLInputElement>('input[type="checkbox"]')
expect(checkbox.element.checked).toBe(true) expect(checkbox.element.checked).toBe(true)
}) })
@@ -71,7 +71,6 @@ function mountWithDraft(batchOverrides: Partial<BatchDetailResponse> = {}) {
store.currentDraft = emptyDraft(batch.batchType, { store.currentDraft = emptyDraft(batch.batchType, {
patient: { patient: {
id: 'dp1', id: 'dp1',
batchId: 'b1',
fullName: 'Jane Doe', fullName: 'Jane Doe',
dateOfBirth: '1990-05-15', dateOfBirth: '1990-05-15',
sex: 'female', sex: 'female',
@@ -362,7 +361,6 @@ describe('VerificationForm', () => {
store.currentDraft = emptyDraft('ALLERGY_UPDATE', { store.currentDraft = emptyDraft('ALLERGY_UPDATE', {
patient: { patient: {
id: 'dp1', id: 'dp1',
batchId: 'b1',
fullName: 'Jane', fullName: 'Jane',
dateOfBirth: '1990-01-01', dateOfBirth: '1990-01-01',
sex: 'female', sex: 'female',
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach } from 'vitest' import { describe, it, expect, vi, beforeEach } from 'vitest'
import { setActivePinia, createPinia } from 'pinia' import { setActivePinia, createPinia } from 'pinia'
import { createRouter, createWebHistory, type RouteLocationNormalized } from 'vue-router' import type { RouteLocationNormalized } from 'vue-router'
import { useAuthStore, getDefaultRouteForRole } from '@/stores/auth' import { useAuthStore, getDefaultRouteForRole } from '@/stores/auth'
vi.mock('@/api/client', () => ({ vi.mock('@/api/client', () => ({
@@ -26,8 +26,7 @@ function setupGuard() {
const nextCalls: (string | undefined)[] = [] const nextCalls: (string | undefined)[] = []
const auth = useAuthStore() const auth = useAuthStore()
function runGuard(to: RouteLocationNormalized, from?: RouteLocationNormalized) { function runGuard(to: RouteLocationNormalized) {
const _from = from ?? buildRoute('/')
const next = vi.fn((dest?: string) => { const next = vi.fn((dest?: string) => {
nextCalls.push(dest) nextCalls.push(dest)
}) })
@@ -81,7 +81,7 @@ describe('useBatchStore', () => {
}) })
it('sets loading=true during request', async () => { it('sets loading=true during request', async () => {
let resolvePromise: (v: unknown) => void let resolvePromise: (v: any) => void
mockedGet.mockReturnValueOnce( mockedGet.mockReturnValueOnce(
new Promise((resolve) => { new Promise((resolve) => {
resolvePromise = resolve resolvePromise = resolve
@@ -83,7 +83,7 @@
</label> </label>
<div v-if="!patient.noKnownAllergies" class="space-y-2"> <div v-if="!patient.noKnownAllergies" class="space-y-2">
<div <div
v-for="(allergy, idx) in allergies" v-for="(_allergy, idx) in allergies"
:key="idx" :key="idx"
class="flex items-center gap-2" class="flex items-center gap-2"
> >
@@ -121,7 +121,7 @@
</label> </label>
<div v-if="!patient.noActiveMedications" class="space-y-2"> <div v-if="!patient.noActiveMedications" class="space-y-2">
<div <div
v-for="(med, idx) in medications" v-for="(_med, idx) in medications"
:key="idx" :key="idx"
class="flex items-center gap-2" class="flex items-center gap-2"
> >
@@ -324,16 +324,6 @@ const observations = ref<DraftObservation[]>([])
const statusColor = ref('bg-gray-100 text-gray-800') const statusColor = ref('bg-gray-100 text-gray-800')
function parseJsonList(json: string | null): string[] {
if (!json) return []
try {
const parsed = JSON.parse(json)
return Array.isArray(parsed) ? parsed : []
} catch {
return []
}
}
// Load draft data when batch changes // Load draft data when batch changes
watch( watch(
() => batchStore.currentDraft, () => batchStore.currentDraft,
@@ -252,16 +252,6 @@ const showAllergies = computed(() => fieldReqs.value?.showAllergies ?? false)
const showMedications = computed(() => fieldReqs.value?.showMedications ?? false) const showMedications = computed(() => fieldReqs.value?.showMedications ?? false)
const showEncounterSummary = computed(() => fieldReqs.value?.showEncounterSummaryFields ?? false) const showEncounterSummary = computed(() => fieldReqs.value?.showEncounterSummaryFields ?? false)
function parseJsonList(json: string | null): string[] {
if (!json) return []
try {
const parsed = JSON.parse(json)
return Array.isArray(parsed) ? parsed : []
} catch {
return []
}
}
watch( watch(
() => batchStore.currentDraft, () => batchStore.currentDraft,
(draft) => { (draft) => {
+3
View File
@@ -3,6 +3,9 @@
"compilerOptions": { "compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"types": ["vite/client"], "types": ["vite/client"],
"paths": {
"@/*": ["./src/*"]
},
/* Linting */ /* Linting */
"noUnusedLocals": true, "noUnusedLocals": true,