test: isolate overseas PDA relabel fixture
This commit is contained in:
@@ -83,7 +83,12 @@ async function fundRelabelWallet(context, customerId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function expectConflict(context, token, method, name, path, body) {
|
async function expectConflict(context, token, method, name, path, body) {
|
||||||
const response = await context.requestOverseas(method, path, body, {}, token)
|
let response = null
|
||||||
|
for (let attempt = 1; attempt <= 3; attempt += 1) {
|
||||||
|
response = await context.requestOverseas(method, path, body, {}, token)
|
||||||
|
if (response?.http !== 0 || attempt === 3) break
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 400 * attempt))
|
||||||
|
}
|
||||||
context.addStep(MODULE, name, response, conflict(response), trace(response), OPTIONS)
|
context.addStep(MODULE, name, response, conflict(response), trace(response), OPTIONS)
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
@@ -748,7 +753,13 @@ export async function run(context) {
|
|||||||
}
|
}
|
||||||
const fixturesByAuxiliaryCapacity = [...handoff.completedFixtures]
|
const fixturesByAuxiliaryCapacity = [...handoff.completedFixtures]
|
||||||
.sort((left, right) => (right?.auxiliaryPallets?.length || 0) - (left?.auxiliaryPallets?.length || 0))
|
.sort((left, right) => (right?.auxiliaryPallets?.length || 0) - (left?.auxiliaryPallets?.length || 0))
|
||||||
const fixture = fixturesByAuxiliaryCapacity.find((item) => Array.isArray(item?.inventory)
|
const fixture = fixturesByAuxiliaryCapacity.find((item) => item?.destinationType !== 'FBA'
|
||||||
|
&& Array.isArray(item?.inventory)
|
||||||
|
&& item.inventory.some((line) => Number(line?.availablePackages) > 1))
|
||||||
|
|| fixturesByAuxiliaryCapacity.find((item) => item?.destinationType !== 'FBA'
|
||||||
|
&& Array.isArray(item?.inventory)
|
||||||
|
&& item.inventory.some((line) => Number(line?.availablePackages) > 0))
|
||||||
|
|| fixturesByAuxiliaryCapacity.find((item) => Array.isArray(item?.inventory)
|
||||||
&& item.inventory.some((line) => Number(line?.availablePackages) > 1))
|
&& item.inventory.some((line) => Number(line?.availablePackages) > 1))
|
||||||
|| fixturesByAuxiliaryCapacity.find((item) => Array.isArray(item?.inventory)
|
|| fixturesByAuxiliaryCapacity.find((item) => Array.isArray(item?.inventory)
|
||||||
&& item.inventory.some((line) => Number(line?.availablePackages) > 0))
|
&& item.inventory.some((line) => Number(line?.availablePackages) > 0))
|
||||||
|
|||||||
Reference in New Issue
Block a user