mc-publish/tests/unit/utils/reflection/module-loader.spec.ts
Kir_Antipov 491aa11ac5 Made ModuleLoader interface
And added 2 default implementations:

 - `NODE_MODULE_LOADER` - uses `import` under the hood
  - `DYNAMIC_MODULE_LOADER` - will be able to load modules needed in other parts of this project. Currently it's just a stub
2023-05-16 20:37:39 +03:00

17 lines
564 B
TypeScript

import { NODE_MODULE_LOADER, DYNAMIC_MODULE_LOADER } from "@/utils/reflection/module-loader";
describe("NODE_MODULE_LOADER", () => {
test("returns undefined if a module cannot be loaded", async () => {
const loadedModule = await NODE_MODULE_LOADER("#");
expect(loadedModule).toBeUndefined();
});
});
describe("DYNAMIC_MODULE_LOADER", () => {
test("returns undefined if a module cannot be loaded", async () => {
const loadedModule = await DYNAMIC_MODULE_LOADER("#");
expect(loadedModule).toBeUndefined();
});
});