Middle+
There is a handler for rendering the last order in the customer's personal account. Below is the response structure from swagger. What 3 business scenarios would you check first? Request: GET /client/last_order?client_id={client_id} Response: { "client_id": "integer", "order_id": "integer", "order": [ { "item_id": "integer", "item_qty": "integer", "item_price": "number" } ], "order_price": "number" }
sobes.tech AI
Answer from AI
-
Verification of data correctness for an existing client with an order:
- Ensure that a request with a valid client_id returns the latest order with correct item_id, item_qty, item_price, and the correct order_price sum.
-
Handling a client without orders:
- Check what happens if the client has no orders (for example, an empty order array or a special status). The system should handle this case correctly without errors.
-
Handling non-existent client_id or incorrect data:
- Verify the response when requesting with a non-existent client_id or incorrect parameter (for example, a string instead of a number). A correct error code and a clear message are expected.