mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
Fix frontend tests and story shots after code splitting was enabled
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user