fix(tax): Make system provider registration backward compatible (#12441)

* fix(tax): Make provider registration backward compatible

* add tests
This commit is contained in:
Oli Juhl
2025-05-12 17:06:43 +02:00
committed by GitHub
parent 60b1fe0676
commit 92af52d133
9 changed files with 74 additions and 22 deletions
@@ -1,7 +1,6 @@
import { ITaxModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import { ITaxModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { createAdminUser } from "../../../../helpers/create-admin-user"
jest.setTimeout(50000)
@@ -27,6 +26,20 @@ medusaIntegrationTestRunner({
await createAdminUser(dbConnection, adminHeaders, appContainer)
})
it("should load local provider and custom provider", async () => {
const providers = await service.listTaxProviders()
expect(providers).toEqual(
expect.arrayContaining([
expect.objectContaining({ id: "tp_system", is_enabled: true }),
expect.objectContaining({
id: "tp_system_system_2",
is_enabled: true,
}),
])
)
})
it("can retrieve a tax rate", async () => {
const region = await service.createTaxRegions({
country_code: "us",