fix(pricing): Update store + list price preferences (#13852)
* fix(pricing): Update store + list price preferencs * Create afraid-kids-return.md
This commit is contained in:
1 parent
c4e1d05c39
commit
f055bfd723
3 files changed
+33
-2
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/pricing": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(pricing): Update store + list price preferences
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
||||||
import { IStoreModuleService } from "@medusajs/types"
|
import { IStoreModuleService } from "@medusajs/types"
|
||||||
import { Modules } from "@medusajs/utils"
|
import { Modules } from "@medusajs/utils"
|
||||||
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
|
|
||||||
import {
|
import {
|
||||||
adminHeaders,
|
adminHeaders,
|
||||||
createAdminUser,
|
createAdminUser,
|
||||||
@@ -66,6 +66,32 @@ medusaIntegrationTestRunner({
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe("POST /admin/stores", () => {
|
describe("POST /admin/stores", () => {
|
||||||
|
it("should update store", async () => {
|
||||||
|
const response = await api.post(
|
||||||
|
`/admin/stores/${store.id}`,
|
||||||
|
{
|
||||||
|
name: "Updated store",
|
||||||
|
|
||||||
|
supported_currencies: [
|
||||||
|
{ currency_code: "eur", is_default: true },
|
||||||
|
{ currency_code: "usd" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
adminHeaders
|
||||||
|
).catch((e) => e)
|
||||||
|
|
||||||
|
expect(response.status).toEqual(200)
|
||||||
|
expect(response.data.store).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
name: "Updated store",
|
||||||
|
supported_currencies: [
|
||||||
|
expect.objectContaining({ currency_code: "eur" }),
|
||||||
|
expect.objectContaining({ currency_code: "usd" }),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it("fails to update default currencies if there is no default one", async () => {
|
it("fails to update default currencies if there is no default one", async () => {
|
||||||
const err = await api
|
const err = await api
|
||||||
.post(
|
.post(
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ export default class PricingModuleService
|
|||||||
): Promise<PricingTypes.PricePreferenceDTO[]> {
|
): Promise<PricingTypes.PricePreferenceDTO[]> {
|
||||||
const pricePreferences = await this.listPricePreferences_(
|
const pricePreferences = await this.listPricePreferences_(
|
||||||
filters,
|
filters,
|
||||||
{ ...config, select: [...(config.select || []), "id"] },
|
config,
|
||||||
sharedContext
|
sharedContext
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user