mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +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();
|
||||
});
|
||||
|
||||
@@ -33,6 +33,7 @@ export type BaseContext = {
|
||||
|
||||
export type LegacyContext = BaseContext & {
|
||||
initialize: () => void;
|
||||
queryClient?: QueryClient;
|
||||
};
|
||||
|
||||
const Context = createContext<LegacyContext | undefined>(undefined);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"presets": ["@scm-manager/babel-preset"]
|
||||
"presets": ["@scm-manager/babel-preset"],
|
||||
"plugins": ["@babel/plugin-syntax-dynamic-import"]
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"test": "jest --passWithNoTests",
|
||||
"lint": "eslint src"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"test": "jest --passWithNoTests",
|
||||
"lint": "eslint src"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user