Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Commit 54fbe70

Browse files
committed
fix: unit test
1 parent cb8fb3b commit 54fbe70

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/loader.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ import loader from "./loader";
88
const mockLoaderContextAsyncCallback = jest.fn();
99
const mockLoaderContextCacheable = jest.fn();
1010
const mockLoaderContextResourcePath = jest.fn();
11+
const mockLoaderContextContext = jest.fn();
1112

1213
beforeEach(() => {
1314
mockLoaderContextAsyncCallback.mockReset();
1415
mockLoaderContextCacheable.mockReset();
1516
mockLoaderContextResourcePath.mockReset();
17+
mockLoaderContextContext.mockReset();
1618
mockLoaderContextResourcePath.mockImplementation(() =>
1719
path.resolve(__dirname, "./__fixtures__/components/Simple.tsx"),
1820
);
21+
mockLoaderContextContext.mockImplementation(() =>
22+
path.resolve(__dirname, "./__fixtures__/"),
23+
);
1924
});
2025

2126
it("marks the loader as being cacheable", () => {
@@ -31,9 +36,10 @@ function executeLoaderWithBoundContext() {
3136
async: mockLoaderContextAsyncCallback,
3237
cacheable: mockLoaderContextCacheable,
3338
resourcePath: mockLoaderContextResourcePath(),
39+
context: mockLoaderContextContext(),
3440
} as Pick<
3541
webpack.loader.LoaderContext,
36-
"async" | "cacheable" | "resourcePath"
42+
"async" | "cacheable" | "resourcePath" | "context"
3743
>) as webpack.loader.LoaderContext,
3844
"// Original Source Code",
3945
);

0 commit comments

Comments
 (0)