fix: 修正自动导入完成提示
- 根据关联文档真实状态识别已完成的历史失败批次 - 完成后自动移除提示并低频复查失败或中断批次
This commit is contained in:
@@ -51,7 +51,7 @@ describe('documentImportBatchStatus', () => {
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('当前页面跟踪的批次完成后继续展示结果', async () => {
|
||||
it('当前页面跟踪的批次完成后移除提示', async () => {
|
||||
vi.useFakeTimers();
|
||||
apiMocks.get
|
||||
.mockResolvedValueOnce({
|
||||
@@ -73,10 +73,62 @@ describe('documentImportBatchStatus', () => {
|
||||
await vi.advanceTimersByTimeAsync(3000);
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.find('.batch-status').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('失败批次关联任务实际完成后不再展示提示', async () => {
|
||||
apiMocks.get.mockResolvedValue({
|
||||
data: {
|
||||
...createBatch('RUNNING', 0),
|
||||
actualCompleted: true,
|
||||
failedCount: 2,
|
||||
pendingCount: 0,
|
||||
status: 'PARTIAL_SUCCEEDED',
|
||||
},
|
||||
errorCode: 0,
|
||||
});
|
||||
|
||||
const wrapper = mount(DocumentImportBatchStatus, {
|
||||
props: { knowledgeId: 'knowledge-1' },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.find('.batch-status').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('失败批次低频复查后在关联任务完成时移除提示', async () => {
|
||||
vi.useFakeTimers();
|
||||
const failedBatch = {
|
||||
...createBatch('RUNNING', 0),
|
||||
actualCompleted: false,
|
||||
failedCount: 2,
|
||||
pendingCount: 0,
|
||||
status: 'PARTIAL_SUCCEEDED',
|
||||
};
|
||||
apiMocks.get
|
||||
.mockResolvedValueOnce({
|
||||
data: failedBatch,
|
||||
errorCode: 0,
|
||||
})
|
||||
.mockResolvedValueOnce({
|
||||
data: { ...failedBatch, actualCompleted: true },
|
||||
errorCode: 0,
|
||||
});
|
||||
|
||||
const wrapper = mount(DocumentImportBatchStatus, {
|
||||
props: { knowledgeId: 'knowledge-1' },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.find('.batch-status').exists()).toBe(true);
|
||||
expect(wrapper.text()).toContain(
|
||||
'documentCollection.importDoc.batchCompleted',
|
||||
);
|
||||
|
||||
await vi.advanceTimersByTimeAsync(15_000);
|
||||
await flushPromises();
|
||||
|
||||
expect(apiMocks.get).toHaveBeenCalledTimes(2);
|
||||
expect(wrapper.find('.batch-status').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
@@ -239,9 +291,7 @@ describe('documentImportBatchStatus', () => {
|
||||
|
||||
expect(apiMocks.get).toHaveBeenCalledTimes(3);
|
||||
expect(wrapper.find('.batch-status__load-error').exists()).toBe(false);
|
||||
expect(wrapper.text()).toContain(
|
||||
'documentCollection.importDoc.batchCompleted',
|
||||
);
|
||||
expect(wrapper.find('.batch-status').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user