feat(platform): add alert notification operations workspace
This commit is contained in:
@@ -1987,6 +1987,88 @@ test('renders quality issues as vehicle-service governance labels', async () =>
|
||||
expect(screen.getByText('车辆已绑定但没有任何来源证据,先确认平台转发、端口和订阅。')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('shows alert rule and notification policy workspace on quality page', async () => {
|
||||
window.history.replaceState(null, '', '/#/quality');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
if (path.includes('/api/ops/health')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
linkHealth: [{ name: 'tdengine', status: 'error', detail: 'write unavailable' }],
|
||||
kafkaLag: 42,
|
||||
activeConnections: 120000,
|
||||
capacityFindings: ['kafka lag 42'],
|
||||
redisOnlineKeys: 368,
|
||||
tdengineWritable: false,
|
||||
mysqlWritable: true,
|
||||
runtime: { requestTimeoutMs: 5000 }
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/quality/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
issueVehicleCount: 3,
|
||||
issueRecordCount: 5,
|
||||
errorCount: 1,
|
||||
warningCount: 4,
|
||||
protocols: [{ name: 'VEHICLE_SERVICE', count: 3 }],
|
||||
issueTypes: [
|
||||
{ name: 'NO_SOURCE', count: 2 },
|
||||
{ name: 'VIN_MISSING', count: 1 },
|
||||
{ name: 'FIELD_MISSING', count: 2 }
|
||||
]
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/quality/issues')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
items: [],
|
||||
total: 0,
|
||||
limit: 20,
|
||||
offset: 0
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { items: [], total: 0, limit: 20, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('告警触发规则')).toBeInTheDocument();
|
||||
expect(screen.getByText('4 类活跃')).toBeInTheDocument();
|
||||
expect(screen.getByText('3 类 P0')).toBeInTheDocument();
|
||||
expect(screen.getByText('容量与存储风险')).toBeInTheDocument();
|
||||
expect(screen.getByText('15 分钟恢复')).toBeInTheDocument();
|
||||
expect(screen.getByText('通知策略')).toBeInTheDocument();
|
||||
expect(screen.getByText('P0 实时中断')).toBeInTheDocument();
|
||||
expect(screen.getByText('接入运维 + 业务责任人')).toBeInTheDocument();
|
||||
expect(screen.getByText('站内告警 / 邮件 / 企业微信')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('opens vehicle service from quality issue with issue source evidence', async () => {
|
||||
window.history.replaceState(null, '', '/#/quality');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
|
||||
Reference in New Issue
Block a user