Skip to content
RED SAGSkills
hard20 pts · first answer countsapi-testingdistributed-systems

Asserting on eventual consistency

After POST /orders, a GET /orders/{id} sometimes returns 404 for a short time because data is copied to a read replica. What is the best way to assert?

await expect.poll(async () => {
  const r = await request.get('/orders/' + id)
  return r.status()
}, { timeout: 10_000 }).toBe(200)
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions