fix(medusa): Allowed properties expand (#4600)
What: The expand allowed properties should allow all the segments whereas the allowed fields should be specific
This commit is contained in:
committed by
GitHub
parent
f12299deb1
commit
9129ca08a7
@@ -215,33 +215,36 @@ describe("/store/carts", () => {
|
||||
"/store/orders?display_id=111&email=test@email.com&fields=status,email"
|
||||
)
|
||||
|
||||
expect(Object.keys(response.data.order)).toEqual([
|
||||
// fields
|
||||
"status",
|
||||
"email",
|
||||
expect(Object.keys(response.data.order)).toHaveLength(20)
|
||||
expect(Object.keys(response.data.order)).toEqual(
|
||||
expect.arrayContaining([
|
||||
// fields
|
||||
"status",
|
||||
"email",
|
||||
|
||||
// relations
|
||||
"shipping_address",
|
||||
"fulfillments",
|
||||
"items",
|
||||
"shipping_methods",
|
||||
"discounts",
|
||||
"customer",
|
||||
"payments",
|
||||
"region",
|
||||
// relations
|
||||
"shipping_address",
|
||||
"fulfillments",
|
||||
"items",
|
||||
"shipping_methods",
|
||||
"discounts",
|
||||
"customer",
|
||||
"payments",
|
||||
"region",
|
||||
|
||||
// totals
|
||||
"shipping_total",
|
||||
"discount_total",
|
||||
"tax_total",
|
||||
"refunded_total",
|
||||
"total",
|
||||
"subtotal",
|
||||
"paid_total",
|
||||
"refundable_amount",
|
||||
"gift_card_total",
|
||||
"gift_card_tax_total",
|
||||
])
|
||||
// totals
|
||||
"shipping_total",
|
||||
"discount_total",
|
||||
"tax_total",
|
||||
"refunded_total",
|
||||
"total",
|
||||
"subtotal",
|
||||
"paid_total",
|
||||
"refundable_amount",
|
||||
"gift_card_total",
|
||||
"gift_card_tax_total",
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it("get order response contains only fields defined with `fields` param", async () => {
|
||||
@@ -249,32 +252,35 @@ describe("/store/carts", () => {
|
||||
|
||||
const response = await api.get("/store/orders/order_test?fields=status")
|
||||
|
||||
expect(Object.keys(response.data.order)).toEqual([
|
||||
// fields
|
||||
"status",
|
||||
expect(Object.keys(response.data.order)).toHaveLength(19)
|
||||
expect(Object.keys(response.data.order)).toEqual(
|
||||
expect.arrayContaining([
|
||||
// fields
|
||||
"status",
|
||||
|
||||
// default relations
|
||||
"shipping_address",
|
||||
"fulfillments",
|
||||
"items",
|
||||
"shipping_methods",
|
||||
"discounts",
|
||||
"customer",
|
||||
"payments",
|
||||
"region",
|
||||
// default relations
|
||||
"shipping_address",
|
||||
"fulfillments",
|
||||
"items",
|
||||
"shipping_methods",
|
||||
"discounts",
|
||||
"customer",
|
||||
"payments",
|
||||
"region",
|
||||
|
||||
// totals
|
||||
"shipping_total",
|
||||
"discount_total",
|
||||
"tax_total",
|
||||
"refunded_total",
|
||||
"total",
|
||||
"subtotal",
|
||||
"paid_total",
|
||||
"refundable_amount",
|
||||
"gift_card_total",
|
||||
"gift_card_tax_total",
|
||||
])
|
||||
// totals
|
||||
"shipping_total",
|
||||
"discount_total",
|
||||
"tax_total",
|
||||
"refunded_total",
|
||||
"total",
|
||||
"subtotal",
|
||||
"paid_total",
|
||||
"refundable_amount",
|
||||
"gift_card_total",
|
||||
"gift_card_tax_total",
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it("get order response contains only fields defined with `fields` and `expand` param", async () => {
|
||||
|
||||
@@ -212,18 +212,21 @@ describe("/store/products", () => {
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(Object.keys(response.data.products[0])).toEqual([
|
||||
// fields
|
||||
"handle",
|
||||
// relations
|
||||
"variants",
|
||||
"options",
|
||||
"images",
|
||||
"tags",
|
||||
"collection",
|
||||
"type",
|
||||
"profiles",
|
||||
])
|
||||
expect(Object.keys(response.data.products[0])).toHaveLength(8)
|
||||
expect(Object.keys(response.data.products[0])).toEqual(
|
||||
expect.arrayContaining([
|
||||
// fields
|
||||
"handle",
|
||||
// relations
|
||||
"variants",
|
||||
"options",
|
||||
"images",
|
||||
"tags",
|
||||
"collection",
|
||||
"type",
|
||||
"profiles",
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it("returns a list of ordered products by id ASC and filtered with free text search", async () => {
|
||||
|
||||
Reference in New Issue
Block a user