fix(medusa): Support fields param in list-variants (#5053)
* fix(medusa): Support fields param in list-variants * Create cuddly-pigs-tease.md * address pr comments
This commit is contained in:
@@ -379,5 +379,38 @@ describe("/store/variants", () => {
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
it("should list variants with id using fields param", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.get("/store/variants?fields=id&expand=&limit=1")
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data).toEqual({
|
||||
variants: [
|
||||
{
|
||||
id: expect.any(String),
|
||||
created_at: expect.any(String),
|
||||
// tax rates, prices, and calculated prices are added regardless of fields and expand
|
||||
calculated_price: null,
|
||||
calculated_price_incl_tax: null,
|
||||
calculated_tax: null,
|
||||
original_price: null,
|
||||
original_price_incl_tax: null,
|
||||
original_tax: null,
|
||||
tax_rates: null,
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
variant_id: expect.any(String),
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
}),
|
||||
]),
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user