fix: return completed loading tasks to the task list
This commit is contained in:
@@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user