This test is done by using Jest and Super Test. You can follow the Strapi Documentation to set it up, or you can install the community plugin strapi-plugin-testing.
it("should not create an order because request empty", async (done) => {
await request(strapi.server)
.post("/orders", { cart: 12 })
.expect(400)