**What** Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate. This pr also includes various fixes in different modules Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
|
import { ICurrencyModuleService, IStoreModuleService } from "@medusajs/types"
|
|
import { medusaIntegrationTestRunner } from "medusa-test-utils"
|
|
|
|
jest.setTimeout(50000)
|
|
|
|
const env = { MEDUSA_FF_MEDUSA_V2: true }
|
|
|
|
medusaIntegrationTestRunner({
|
|
env,
|
|
testSuite: ({ getContainer }) => {
|
|
describe("Link: Store Currency", () => {
|
|
let appContainer
|
|
let storeModuleService: IStoreModuleService
|
|
let currencyModuleService: ICurrencyModuleService
|
|
let remoteQuery
|
|
|
|
beforeAll(async () => {
|
|
appContainer = getContainer()
|
|
storeModuleService = appContainer.resolve(ModuleRegistrationName.STORE)
|
|
currencyModuleService = appContainer.resolve(
|
|
ModuleRegistrationName.CURRENCY
|
|
)
|
|
remoteQuery = appContainer.resolve("remoteQuery")
|
|
})
|
|
|
|
it("should query store and default currency with remote query", async () => {
|
|
const store = await storeModuleService.createStores({
|
|
name: "Store",
|
|
default_currency_code: "usd",
|
|
supported_currency_codes: ["usd"],
|
|
})
|
|
|
|
const stores = await remoteQuery({
|
|
store: {
|
|
fields: ["id"],
|
|
default_currency: {
|
|
fields: ["code"],
|
|
},
|
|
},
|
|
})
|
|
|
|
expect(stores).toEqual(
|
|
expect.arrayContaining([
|
|
expect.objectContaining({
|
|
id: store.id,
|
|
default_currency: expect.objectContaining({ code: "usd" }),
|
|
}),
|
|
])
|
|
)
|
|
})
|
|
})
|
|
},
|
|
})
|