chore: Migrate modules to use the Module util (#7964)
**What** Apply the `Module` util to each module to handle the export and provide the linkable configuration object. - Most joiner config that does not have any special config are removed/cleaned up in favor of the autogenerated one or simpler one - linkable are now available in all modules - cleaned up the dependencies of the modules FIXES CORE-2410
This commit is contained in:
committed by
GitHub
parent
eafa3560ae
commit
b368251ca3
@@ -1,11 +1,12 @@
|
||||
import { IApiKeyModuleService } from "@medusajs/types"
|
||||
import { ApiKeyType, Modules } from "@medusajs/utils"
|
||||
import { ApiKeyType, Module, Modules } from "@medusajs/utils"
|
||||
import crypto from "crypto"
|
||||
import { moduleIntegrationTestRunner } from "medusa-test-utils"
|
||||
import {
|
||||
createPublishableKeyFixture,
|
||||
createSecretKeyFixture,
|
||||
} from "../__fixtures__"
|
||||
import { ApiKeyModuleService } from "@services"
|
||||
|
||||
jest.setTimeout(100000)
|
||||
|
||||
@@ -39,6 +40,25 @@ moduleIntegrationTestRunner<IApiKeyModuleService>({
|
||||
jest.restoreAllMocks()
|
||||
})
|
||||
|
||||
it(`should export the appropriate linkable configuration`, () => {
|
||||
const linkable = Module(Modules.API_KEY, {
|
||||
service: ApiKeyModuleService,
|
||||
}).linkable
|
||||
|
||||
expect(Object.keys(linkable)).toEqual(["apiKey"])
|
||||
|
||||
linkable.apiKey.toJSON = undefined
|
||||
|
||||
expect(linkable.apiKey).toEqual({
|
||||
id: {
|
||||
linkable: "api_key_id",
|
||||
primaryKey: "id",
|
||||
serviceName: "apiKey",
|
||||
field: "apiKey",
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
describe("API Key Module Service", () => {
|
||||
describe("creating a publishable API key", () => {
|
||||
it("should create it successfully", async function () {
|
||||
|
||||
Reference in New Issue
Block a user