fix(platform): avoid false storage error while health loads
This commit is contained in:
@@ -4101,6 +4101,33 @@ test('opens quality governance from vehicle detail overview', async () => {
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/quality/issues?keyword=VIN001&limit=20&offset=0'), undefined);
|
||||
});
|
||||
|
||||
test('quality health storage card stays pending before ops health loads', async () => {
|
||||
window.history.replaceState(null, '', '/#/quality');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
if (path.includes('/api/ops/health')) {
|
||||
return new Promise<Response>(() => undefined);
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: path.includes('/api/quality/summary')
|
||||
? { issueVehicleCount: 0, issueRecordCount: 0, errorCount: 0, warningCount: 0, protocols: [], issueTypes: [] }
|
||||
: { items: [], total: 0, limit: 20, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByRole('heading', { name: '质量治理' })).toBeInTheDocument();
|
||||
expect(screen.getByText('存储读取')).toBeInTheDocument();
|
||||
expect(screen.getByText('检测中')).toBeInTheDocument();
|
||||
expect(screen.queryByText('异常')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('shows vehicle service evidence chain before source details', async () => {
|
||||
window.history.replaceState(null, '', '/#/detail?keyword=VIN001');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
|
||||
Reference in New Issue
Block a user