Skip to content

Commit f055bfd

Browse files
authored
fix(pricing): Update store + list price preferences (#13852)
* fix(pricing): Update store + list price preferencs * Create afraid-kids-return.md
1 parent c4e1d05 commit f055bfd

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

.changeset/afraid-kids-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/pricing": patch
3+
---
4+
5+
fix(pricing): Update store + list price preferences

integration-tests/http/__tests__/store/admin/store.spec.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
12
import { IStoreModuleService } from "@medusajs/types"
23
import { Modules } from "@medusajs/utils"
3-
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
44
import {
55
adminHeaders,
66
createAdminUser,
@@ -66,6 +66,32 @@ medusaIntegrationTestRunner({
6666
})
6767

6868
describe("POST /admin/stores", () => {
69+
it("should update store", async () => {
70+
const response = await api.post(
71+
`/admin/stores/${store.id}`,
72+
{
73+
name: "Updated store",
74+
75+
supported_currencies: [
76+
{ currency_code: "eur", is_default: true },
77+
{ currency_code: "usd" },
78+
],
79+
},
80+
adminHeaders
81+
).catch((e) => e)
82+
83+
expect(response.status).toEqual(200)
84+
expect(response.data.store).toEqual(
85+
expect.objectContaining({
86+
name: "Updated store",
87+
supported_currencies: [
88+
expect.objectContaining({ currency_code: "eur" }),
89+
expect.objectContaining({ currency_code: "usd" }),
90+
],
91+
})
92+
)
93+
})
94+
6995
it("fails to update default currencies if there is no default one", async () => {
7096
const err = await api
7197
.post(

packages/modules/pricing/src/services/pricing-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export default class PricingModuleService
365365
): Promise<PricingTypes.PricePreferenceDTO[]> {
366366
const pricePreferences = await this.listPricePreferences_(
367367
filters,
368-
{ ...config, select: [...(config.select || []), "id"] },
368+
config,
369369
sharedContext
370370
)
371371

0 commit comments

Comments
 (0)