Fix frontend tests and story shots after code splitting was enabled

This commit is contained in:
Eduard Heimbuch
2022-03-01 15:33:48 +01:00
parent f125f75dc6
commit 151c7bf772
6 changed files with 220 additions and 4071 deletions

View File

@@ -23,18 +23,24 @@
*/
import { LegacyContext, LegacyContextProvider, useLegacyContext } from "./LegacyContext";
import { FC } from "react";
import * as React from "react";
import { FC } from "react";
import { renderHook } from "@testing-library/react-hooks";
import { QueryClient, QueryClientProvider } from "react-query";
describe("LegacyContext tests", () => {
const queryClient = new QueryClient();
const createWrapper = (context?: LegacyContext): FC => {
return ({ children }) => <LegacyContextProvider {...context}>{children}</LegacyContextProvider>;
return ({ children }) => (
<QueryClientProvider client={queryClient}>
<LegacyContextProvider {...context}>{children}</LegacyContextProvider>
</QueryClientProvider>
);
};
it("should return provided context", () => {
const { result } = renderHook(() => useLegacyContext(), {
wrapper: createWrapper(),
wrapper: createWrapper()
});
expect(result.current).toBeDefined();
});