Skip to content

Commit

Permalink
Revert (Jest) test back to original form and patch it up
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikur-nc committed Nov 8, 2024
1 parent f3a2ff3 commit 6e4d751
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/load/tests/use-custom-loader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { useCustomLoader } from '../src/utils/custom-loader.js';
import { getCustomLoaderByPath } from '../src/utils/custom-loader.js';

describe('useCustomLoader', () => {
it.each(['cjs', 'mjs'])(
'can load a custom loader from a file path',
async (extension: string) => {
const loader = await useCustomLoader(`./custom-loader.${extension}`, __dirname);
const result = await loader('some-name', { customLoaderContext: {} });
expect(result).toEqual('I like turtles');
},
);
describe('getCustomLoaderByPath', () => {
it('can load a custom loader from a file path', async () => {
const loader = await getCustomLoaderByPath('./custom-loader.cjs', __dirname);
expect(loader).toBeDefined();
expect(loader('some-name', { customLoaderContext: {} })).toEqual('I like turtles');
});
});

0 comments on commit 6e4d751

Please sign in to comment.