18.31Scenario 30 — Async integration test
Endpoint:
POST /customers
→ 202
Then:
const response = await request.post('/customers', {
data: customer
});
expect(response.status()).toBe(202);
const account = await pollUntil(
() => salesforce.findAccount(customer.customerId),
account => account !== null,
{ timeoutMs: 30_000 }
);
expect(account.Name).toBe(customer.companyName);
Explain:
“I poll the completion condition with a bounded timeout rather than use a fixed sleep.”