chore(): Remove default_locale from StoreLocale (#14300)

## Summary

**What** — What changes are introduced in this PR?

Remove `default_locale` from Store <> Locale relation

**Why** — Why are these changes relevant or necessary?  

*Please provide answer here*

**How** — How have these changes been implemented?

*Please provide answer here*

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [ ] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.


Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Nicolas Gorga
2025-12-15 06:05:46 -03:00
committed by GitHub
parent dd3eb10b1a
commit 8964a03fa1
23 changed files with 63 additions and 226 deletions

View File

@@ -8,7 +8,7 @@ export const createStoreFixture: StoreTypes.CreateStoreDTO = {
],
supported_locales: [
{ locale_code: "fr-FR" },
{ locale_code: "en-US", is_default: true },
{ locale_code: "en-US" },
],
default_sales_channel_id: "test-sales-channel",
default_region_id: "test-region",

View File

@@ -1,7 +1,7 @@
import { IStoreModuleService } from "@medusajs/framework/types"
import { Module, Modules } from "@medusajs/framework/utils"
import { StoreModuleService } from "@services"
import { moduleIntegrationTestRunner } from "@medusajs/test-utils"
import { StoreModuleService } from "@services"
import { createStoreFixture } from "../__fixtures__"
jest.setTimeout(100000)
@@ -92,19 +92,6 @@ moduleIntegrationTestRunner<IStoreModuleService>({
"There should be a default currency set for the store"
)
})
it("should fail to get created if there is no default locale", async function () {
const err = await service
.createStores({
...createStoreFixture,
supported_locales: [{ locale_code: "en-US" }],
})
.catch((err) => err.message)
expect(err).toEqual(
"There should be a default locale set for the store"
)
})
})
describe("upserting a store", () => {
@@ -160,19 +147,6 @@ moduleIntegrationTestRunner<IStoreModuleService>({
)
})
it("should fail updating locales without a default one", async function () {
const createdStore = await service.createStores(createStoreFixture)
const updateErr = await service
.updateStores(createdStore.id, {
supported_locales: [{ locale_code: "en-US" }],
})
.catch((err) => err.message)
expect(updateErr).toEqual(
"There should be a default locale set for the store"
)
})
it("should fail updating currencies where a duplicate currency code exists", async function () {
const createdStore = await service.createStores(createStoreFixture)
const updateErr = await service
@@ -214,20 +188,6 @@ moduleIntegrationTestRunner<IStoreModuleService>({
expect(updateErr).toEqual("Only one default currency is allowed")
})
it("should fail updating locales where there is more than 1 default locale", async function () {
const createdStore = await service.createStores(createStoreFixture)
const updateErr = await service
.updateStores(createdStore.id, {
supported_locales: [
{ locale_code: "en-US", is_default: true },
{ locale_code: "fr-FR", is_default: true },
],
})
.catch((err) => err.message)
expect(updateErr).toEqual("Only one default locale is allowed")
})
})
describe("deleting a store", () => {