This commit is contained in:
2026-10-22 11:56:54 +08:00
parent 090431b409
commit 3e77c3976e
40 changed files with 976 additions and 241 deletions
@@ -22,6 +22,9 @@ beforeEach(() => {
it('binds the uploaded file to the car and restores the original binding after reopening without uploading twice', async () => {
vi.mocked(bindVehiclePhoto).mockRejectedValueOnce(new Error('network timeout'))
const first = setup(); await flushPromises(); await upload(first)
const table = first.get('table[aria-label="油耗图片"]')
expect(table.findAll('thead th').map(cell => cell.text())).toEqual(['操作', '图片类别', '文件名称', '保存时间'])
expect(table.findAll('tbody tr').map(row => row.findAll('td')[1]!.text())).toEqual(['起始油耗表盘', '结束油耗表盘'])
const original = vi.mocked(bindVehiclePhoto).mock.calls[0]![2]
expect(original).toMatchObject({ recordVersion: '3', fileId: photo.fileId })
first.unmount()
@@ -30,6 +33,7 @@ it('binds the uploaded file to the car and restores the original binding after r
expect(bindVehiclePhoto).toHaveBeenLastCalledWith('PC/1', 'FUEL_START', original)
expect(uploadVehiclePhoto).toHaveBeenCalledTimes(1)
expect(reopened.text()).toContain('fuel.png')
expect(reopened.get('table tbody tr').text()).toContain('2026-10-21 00:00:00Z')
expect(sessionStorage.length).toBe(0)
reopened.unmount()
})