feat(medusa): Allow creating DraftOrders without items (#2719)

This commit is contained in:
josetr
2022-12-20 17:37:42 +00:00
committed by GitHub
parent d8893d6b9f
commit 3113d8024f
6 changed files with 39 additions and 22 deletions

View File

@@ -381,6 +381,30 @@ describe("/admin/draft-orders", () => {
expect(response.status).toEqual(200)
})
it("creates a draft order without a single item", async () => {
const api = useApi()
const payload = {
email: "oli@test.dk",
shipping_address: "oli-shipping",
region_id: "test-region",
customer_id: "oli-test",
shipping_methods: [
{
option_id: "test-option",
},
],
}
const response = await api.post(
"/admin/draft-orders",
payload,
adminReqConfig
)
expect(response.data.draft_order.cart.items).toEqual([])
expect(response.status).toEqual(200)
})
it("creates a draft order with product variant with custom price and custom item price set to 0", async () => {
const api = useApi()