fix: return completed loading tasks to the task list

This commit is contained in:
2026-11-05 16:30:49 +08:00
parent 63fac79814
commit 500103e734
4 changed files with 108 additions and 6 deletions
+4 -2
View File
@@ -63,18 +63,19 @@ test('query failure is not retried as a completion mutation and completed accept
readTask: async () => assert.fail('no query after authoritative completion'), isActive: () => true, onTask() {} }), completed)
})
test('page only announces success without persisting a replay request after authoritative completion', async () => {
test('page only returns to the task list after authoritative completion without persisting a replay request', async () => {
const page = await readFile(new URL('../pages/picking/picking.vue', import.meta.url), 'utf8')
const method = page.match(/async completeLoadingTask\(\) \{[\s\S]*?\n\t\t\t\},/)?.[0]
assert.ok(method)
for (const status of ['COMPLETED', 'COMPLETION_FAILED', 'COMPLETING', 'LOADING', 'QUERY_ERROR', 'NO_RESPONSE']) {
const messages = [], cleared = [], saved = []
const messages = [], cleared = [], saved = [], destinations = []
const bindings = {
COMPLETION_PHASE, resolveCompletionPhase, shouldReconcileCompletion,
isRemoteReady: () => true, restoreLoadingCompletionAttempt: () => null,
stableTaskOperationIdentity: () => 'stable-task', stableOperationId: () => 'original-operation',
saveLoadingCompletionAttempt: (_, attempt) => saved.push(attempt),
clearLoadingCompletionAttempt: identity => cleared.push(identity),
navigateBackOr: url => destinations.push(url),
completeContainerPickingTask: async () => status === 'NO_RESPONSE' ? null : { taskStatus: 'COMPLETING', version: 2 },
normalizePickingTask: task => task,
observeLoadingCompletion: async options => {
@@ -99,6 +100,7 @@ test('page only announces success without persisting a replay request after auth
assert.equal(saved.length, 0)
assert.equal(cleared.length, 0)
assert.equal(messages.some(message => message.message === '装柜已完成'), status === 'COMPLETED')
assert.deepEqual(destinations, status === 'COMPLETED' ? ['/pages/tasks/tasks'] : [])
if (status !== 'COMPLETED') assert.ok(context.remoteError)
}
})