fix(tax): Make system provider registration backward compatible (#12441)
* fix(tax): Make provider registration backward compatible * add tests
This commit is contained in:
1 parent
60b1fe0676
commit
92af52d133
9 files changed
+74
-22
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { ITaxModuleService } from "@medusajs/framework/types"
|
||||
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
import { moduleIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
moduleIntegrationTestRunner<ITaxModuleService>({
|
||||
moduleName: Modules.TAX,
|
||||
testSuite: ({ service }) => {
|
||||
describe("Tax Module Service", () => {
|
||||
describe("providers", () => {
|
||||
it("should have loaded local tax provider successfully", async () => {
|
||||
const providers = await service.listTaxProviders()
|
||||
|
||||
expect(providers).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "tp_system",
|
||||
is_enabled: true,
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -27,17 +27,17 @@ export const setupTaxStructure = async (service: ITaxModuleService) => {
|
||||
const [us, dk, de, ca] = await service.createTaxRegions([
|
||||
{
|
||||
country_code: "US",
|
||||
provider_id: "tp_system_system",
|
||||
provider_id: "tp_system",
|
||||
default_tax_rate: { name: "US Default Rate", rate: 2, code: "US" },
|
||||
},
|
||||
{
|
||||
country_code: "DK",
|
||||
provider_id: "tp_system_system",
|
||||
provider_id: "tp_system",
|
||||
default_tax_rate: { name: "Denmark Default Rate", rate: 25, code: "DK" },
|
||||
},
|
||||
{
|
||||
country_code: "DE",
|
||||
provider_id: "tp_system_system",
|
||||
provider_id: "tp_system",
|
||||
default_tax_rate: {
|
||||
code: "DE19",
|
||||
name: "Germany Default Rate",
|
||||
@@ -46,7 +46,7 @@ export const setupTaxStructure = async (service: ITaxModuleService) => {
|
||||
},
|
||||
{
|
||||
country_code: "CA",
|
||||
provider_id: "tp_system_system",
|
||||
provider_id: "tp_system",
|
||||
default_tax_rate: { name: "Canada Default Rate", rate: 5, code: "CA" },
|
||||
},
|
||||
])
|
||||
|
||||
Reference in new issue
Block a user