@backstage/test-utils 1.7.6-next.0 → 1.7.7-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @backstage/test-utils
|
|
2
2
|
|
|
3
|
+
## 1.7.7-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
8
|
+
|
|
9
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/core-plugin-api@1.10.6-next.0
|
|
13
|
+
- @backstage/plugin-permission-react@0.4.33-next.0
|
|
14
|
+
- @backstage/core-app-api@1.16.1-next.0
|
|
15
|
+
- @backstage/theme@0.6.5-next.0
|
|
16
|
+
- @backstage/config@1.3.2
|
|
17
|
+
- @backstage/types@1.2.1
|
|
18
|
+
- @backstage/plugin-permission-common@0.8.4
|
|
19
|
+
|
|
20
|
+
## 1.7.6
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 37c6510: Moved `@types/jest` to `devDependencies`.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @backstage/core-plugin-api@1.10.5
|
|
27
|
+
- @backstage/core-app-api@1.16.0
|
|
28
|
+
- @backstage/plugin-permission-react@0.4.32
|
|
29
|
+
- @backstage/config@1.3.2
|
|
30
|
+
- @backstage/theme@0.6.4
|
|
31
|
+
- @backstage/types@1.2.1
|
|
32
|
+
- @backstage/plugin-permission-common@0.8.4
|
|
33
|
+
|
|
3
34
|
## 1.7.6-next.0
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ import crossFetch from 'cross-fetch';
|
|
|
6
6
|
import { PermissionApi } from '@backstage/plugin-permission-react';
|
|
7
7
|
import { EvaluatePermissionRequest, AuthorizeResult, EvaluatePermissionResponse } from '@backstage/plugin-permission-common';
|
|
8
8
|
import { TranslationApi } from '@backstage/core-plugin-api/alpha';
|
|
9
|
-
import
|
|
9
|
+
import { ReactElement, ReactNode, ComponentType, PropsWithChildren } from 'react';
|
|
10
10
|
import { AppIcons } from '@backstage/core-app-api';
|
|
11
11
|
import { RenderOptions, RenderResult, MatcherFunction } from '@testing-library/react';
|
|
12
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @public
|
|
@@ -733,6 +734,6 @@ declare class TestApiRegistry implements ApiHolder {
|
|
|
733
734
|
*
|
|
734
735
|
* @public
|
|
735
736
|
*/
|
|
736
|
-
declare const TestApiProvider: <T extends any[]>(props: TestApiProviderProps<T>) =>
|
|
737
|
+
declare const TestApiProvider: <T extends any[]>(props: TestApiProviderProps<T>) => react_jsx_runtime.JSX.Element;
|
|
737
738
|
|
|
738
739
|
export { type ApiMock, type AsyncLogCollector, type CollectedLogs, type ErrorWithContext, type LegacyRootOption, type LogCollector, type LogFuncs, MockAnalyticsApi, MockConfigApi, MockErrorApi, type MockErrorApiOptions, MockFetchApi, type MockFetchApiOptions, MockPermissionApi, MockStorageApi, type MockStorageBucket, type SyncLogCollector, TestApiProvider, type TestApiProviderProps, TestApiRegistry, type TestAppOptions, createTestAppWrapper, mockApis, mockBreakpoint, registerMswTestHooks, renderInTestApp, renderWithEffects, setupRequestMockHandlers, textContentMatcher, withLogCollector, wrapInTestApp };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ApiProvider } from '@backstage/core-app-api';
|
|
3
3
|
|
|
4
4
|
class TestApiRegistry {
|
|
@@ -37,7 +37,7 @@ class TestApiRegistry {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
const TestApiProvider = (props) => {
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
41
|
ApiProvider,
|
|
42
42
|
{
|
|
43
43
|
apis: TestApiRegistry.from(...props.apis),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestApiProvider.esm.js","sources":["../../src/testUtils/TestApiProvider.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"TestApiProvider.esm.js","sources":["../../src/testUtils/TestApiProvider.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport { ApiProvider } from '@backstage/core-app-api';\nimport { ApiRef, ApiHolder } from '@backstage/core-plugin-api';\n\n/** @ignore */\ntype TestApiProviderPropsApiPair<TApi> = TApi extends infer TImpl\n ? readonly [ApiRef<TApi>, Partial<TImpl>]\n : never;\n\n/** @ignore */\ntype TestApiProviderPropsApiPairs<TApiPairs> = {\n [TIndex in keyof TApiPairs]: TestApiProviderPropsApiPair<TApiPairs[TIndex]>;\n};\n\n/**\n * Properties for the {@link TestApiProvider} component.\n *\n * @public\n */\nexport type TestApiProviderProps<TApiPairs extends any[]> = {\n apis: readonly [...TestApiProviderPropsApiPairs<TApiPairs>];\n children: ReactNode;\n};\n\n/**\n * The `TestApiRegistry` is an {@link @backstage/core-plugin-api#ApiHolder} implementation\n * that is particularly well suited for development and test environments such as\n * unit tests, storybooks, and isolated plugin development setups.\n *\n * @public\n */\nexport class TestApiRegistry implements ApiHolder {\n /**\n * Creates a new {@link TestApiRegistry} with a list of API implementation pairs.\n *\n * Similar to the {@link TestApiProvider}, there is no need to provide a full\n * implementation of each API, it's enough to implement the methods that are tested.\n *\n * @example\n * ```ts\n * const apis = TestApiRegistry.from(\n * [configApiRef, new ConfigReader({})],\n * [identityApiRef, { getUserId: () => 'tester' }],\n * );\n * ```\n *\n * @public\n * @param apis - A list of pairs mapping an ApiRef to its respective implementation.\n */\n static from<TApiPairs extends any[]>(\n ...apis: readonly [...TestApiProviderPropsApiPairs<TApiPairs>]\n ) {\n return new TestApiRegistry(\n new Map(apis.map(([api, impl]) => [api.id, impl])),\n );\n }\n\n private constructor(private readonly apis: Map<string, unknown>) {}\n\n /**\n * Returns an implementation of the API.\n *\n * @public\n */\n get<T>(api: ApiRef<T>): T | undefined {\n return this.apis.get(api.id) as T | undefined;\n }\n}\n\n/**\n * The `TestApiProvider` is a Utility API context provider that is particularly\n * well suited for development and test environments such as unit tests, storybooks,\n * and isolated plugin development setups.\n *\n * It lets you provide any number of API implementations, without necessarily\n * having to fully implement each of the APIs.\n *\n * @remarks\n * todo: remove this remark tag and ship in the api-reference. There's some odd formatting going on when this is made into a markdown doc, that there's no line break between\n * the emitted <p> for To the following </p> so what happens is that when parsing in docusaurus, it thinks that the code block is mdx rather than a code\n * snippet. Just omitting this from the report for now until we can work out how to fix later.\n * A migration from `ApiRegistry` and `ApiProvider` might look like this, from:\n *\n * ```tsx\n * renderInTestApp(\n * <ApiProvider\n * apis={ApiRegistry.from([\n * [identityApiRef, mockIdentityApi as unknown as IdentityApi]\n * ])}\n * >\n * ...\n * </ApiProvider>\n * )\n * ```\n *\n * To the following:\n *\n * ```tsx\n * renderInTestApp(\n * <TestApiProvider apis={[[identityApiRef, mockIdentityApi]]}>\n * ...\n * </TestApiProvider>\n * )\n * ```\n *\n * Note that the cast to `IdentityApi` is no longer needed as long as the mock API\n * implements a subset of the `IdentityApi`.\n *\n * @public\n */\nexport const TestApiProvider = <T extends any[]>(\n props: TestApiProviderProps<T>,\n) => {\n return (\n <ApiProvider\n apis={TestApiRegistry.from(...props.apis)}\n children={props.children}\n />\n );\n};\n"],"names":[],"mappings":";;;AA+CO,MAAM,eAAqC,CAAA;AAAA,EA0BxC,YAA6B,IAA4B,EAAA;AAA5B,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA;AAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EARlE,OAAO,QACF,IACH,EAAA;AACA,IAAA,OAAO,IAAI,eAAA;AAAA,MACT,IAAI,GAAA,CAAI,IAAK,CAAA,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,IAAI,CAAA,KAAM,CAAC,GAAA,CAAI,EAAI,EAAA,IAAI,CAAC,CAAC;AAAA,KACnD;AAAA;AACF;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAO,GAA+B,EAAA;AACpC,IAAA,OAAO,IAAK,CAAA,IAAA,CAAK,GAAI,CAAA,GAAA,CAAI,EAAE,CAAA;AAAA;AAE/B;AA2Ca,MAAA,eAAA,GAAkB,CAC7B,KACG,KAAA;AACH,EACE,uBAAA,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,eAAA,CAAgB,IAAK,CAAA,GAAG,MAAM,IAAI,CAAA;AAAA,MACxC,UAAU,KAAM,CAAA;AAAA;AAAA,GAClB;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { createElement } from 'react';
|
|
2
3
|
import { MemoryRouter, Route } from 'react-router-dom';
|
|
3
4
|
import { UnifiedThemeProvider, themes } from '@backstage/theme';
|
|
4
5
|
import MockIcon from '@material-ui/icons/AcUnit';
|
|
@@ -44,7 +45,7 @@ const NotFoundErrorPage = () => {
|
|
|
44
45
|
const BootErrorPage = ({ step, error }) => {
|
|
45
46
|
throw new Error(`Reached BootError Page at step ${step} with error ${error}`);
|
|
46
47
|
};
|
|
47
|
-
const Progress = () => /* @__PURE__ */
|
|
48
|
+
const Progress = () => /* @__PURE__ */ jsx("div", { "data-testid": "progress" });
|
|
48
49
|
const NoRender = (_props) => null;
|
|
49
50
|
function isExternalRouteRef(routeRef) {
|
|
50
51
|
return String(routeRef).includes("{type=external,");
|
|
@@ -63,7 +64,7 @@ function createTestAppWrapper(options = {}) {
|
|
|
63
64
|
BootErrorPage,
|
|
64
65
|
NotFoundErrorPage,
|
|
65
66
|
ErrorBoundaryFallback,
|
|
66
|
-
Router: ({ children }) => /* @__PURE__ */
|
|
67
|
+
Router: ({ children }) => /* @__PURE__ */ jsx(MemoryRouter, { initialEntries: routeEntries, children }),
|
|
67
68
|
...options.components
|
|
68
69
|
},
|
|
69
70
|
icons: {
|
|
@@ -76,7 +77,7 @@ function createTestAppWrapper(options = {}) {
|
|
|
76
77
|
id: "light",
|
|
77
78
|
title: "Test App Theme",
|
|
78
79
|
variant: "light",
|
|
79
|
-
Provider: ({ children }) => /* @__PURE__ */
|
|
80
|
+
Provider: ({ children }) => /* @__PURE__ */ jsx(UnifiedThemeProvider, { theme: themes.light, children })
|
|
80
81
|
}
|
|
81
82
|
],
|
|
82
83
|
bindRoutes: ({ bind }) => {
|
|
@@ -92,7 +93,10 @@ function createTestAppWrapper(options = {}) {
|
|
|
92
93
|
});
|
|
93
94
|
const routeElements = Object.entries(options.mountedRoutes ?? {}).map(
|
|
94
95
|
([path, routeRef]) => {
|
|
95
|
-
const Page = () => /* @__PURE__ */
|
|
96
|
+
const Page = () => /* @__PURE__ */ jsxs("div", { children: [
|
|
97
|
+
"Mounted at ",
|
|
98
|
+
path
|
|
99
|
+
] });
|
|
96
100
|
if (isExternalRouteRef(routeRef)) {
|
|
97
101
|
const absoluteRef = createRouteRef({ id: "id" });
|
|
98
102
|
boundRoutes.set(routeRef, absoluteRef);
|
|
@@ -100,28 +104,31 @@ function createTestAppWrapper(options = {}) {
|
|
|
100
104
|
} else {
|
|
101
105
|
attachComponentData(Page, "core.mountPoint", routeRef);
|
|
102
106
|
}
|
|
103
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ jsx(Route, { path, element: /* @__PURE__ */ jsx(Page, {}) }, path);
|
|
104
108
|
}
|
|
105
109
|
);
|
|
106
110
|
const AppProvider = app.getProvider();
|
|
107
111
|
const AppRouter = app.getRouter();
|
|
108
|
-
const TestAppWrapper = ({ children }) => /* @__PURE__ */
|
|
112
|
+
const TestAppWrapper = ({ children }) => /* @__PURE__ */ jsx(AppProvider, { children: /* @__PURE__ */ jsxs(AppRouter, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx(NoRender, { children: routeElements }),
|
|
114
|
+
children
|
|
115
|
+
] }) });
|
|
109
116
|
return TestAppWrapper;
|
|
110
117
|
}
|
|
111
118
|
function wrapInTestApp(Component, options = {}) {
|
|
112
119
|
const TestAppWrapper = createTestAppWrapper(options);
|
|
113
120
|
let wrappedElement;
|
|
114
121
|
if (Component instanceof Function) {
|
|
115
|
-
wrappedElement =
|
|
122
|
+
wrappedElement = createElement(Component);
|
|
116
123
|
} else {
|
|
117
124
|
wrappedElement = Component;
|
|
118
125
|
}
|
|
119
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ jsx(TestAppWrapper, { children: wrappedElement });
|
|
120
127
|
}
|
|
121
128
|
async function renderInTestApp(Component, options = {}) {
|
|
122
129
|
let wrappedElement;
|
|
123
130
|
if (Component instanceof Function) {
|
|
124
|
-
wrappedElement =
|
|
131
|
+
wrappedElement = createElement(Component);
|
|
125
132
|
} else {
|
|
126
133
|
wrappedElement = Component;
|
|
127
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appWrappers.esm.js","sources":["../../src/testUtils/appWrappers.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentType,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n} from 'react';\nimport { MemoryRouter, Route } from 'react-router-dom';\nimport { themes, UnifiedThemeProvider } from '@backstage/theme';\nimport MockIcon from '@material-ui/icons/AcUnit';\nimport { AppIcons, createSpecializedApp } from '@backstage/core-app-api';\nimport {\n AppComponents,\n attachComponentData,\n BootErrorPageProps,\n createRouteRef,\n ExternalRouteRef,\n IconComponent,\n RouteRef,\n} from '@backstage/core-plugin-api';\nimport { MatcherFunction, RenderResult } from '@testing-library/react';\nimport { LegacyRootOption, renderWithEffects } from './testingLibrary';\nimport { defaultApis } from './defaultApis';\nimport { mockApis } from './mockApis';\n\nconst mockIcons = {\n 'kind:api': MockIcon,\n 'kind:component': MockIcon,\n 'kind:domain': MockIcon,\n 'kind:group': MockIcon,\n 'kind:location': MockIcon,\n 'kind:system': MockIcon,\n 'kind:user': MockIcon,\n 'kind:resource': MockIcon,\n 'kind:template': MockIcon,\n\n brokenImage: MockIcon,\n catalog: MockIcon,\n scaffolder: MockIcon,\n techdocs: MockIcon,\n search: MockIcon,\n chat: MockIcon,\n dashboard: MockIcon,\n docs: MockIcon,\n email: MockIcon,\n github: MockIcon,\n group: MockIcon,\n help: MockIcon,\n user: MockIcon,\n warning: MockIcon,\n star: MockIcon,\n unstarred: MockIcon,\n};\n\nconst ErrorBoundaryFallback = ({ error }: { error: Error }) => {\n throw new Error(`Reached ErrorBoundaryFallback Page with error, ${error}`);\n};\nconst NotFoundErrorPage = () => {\n throw new Error('Reached NotFound Page');\n};\nconst BootErrorPage = ({ step, error }: BootErrorPageProps) => {\n throw new Error(`Reached BootError Page at step ${step} with error ${error}`);\n};\nconst Progress = () => <div data-testid=\"progress\" />;\n\nconst NoRender = (_props: { children: ReactNode }) => null;\n\n/**\n * Options to customize the behavior of the test app wrapper.\n * @public\n */\nexport type TestAppOptions = {\n /**\n * Initial route entries to pass along as `initialEntries` to the router.\n */\n routeEntries?: string[];\n\n /**\n * An object of paths to mount route ref on, with the key being the path and the value\n * being the RouteRef that the path will be bound to. This allows the route refs to be\n * used by `useRouteRef` in the rendered elements.\n *\n * @example\n * wrapInTestApp(<MyComponent />, \\{\n * mountedRoutes: \\{\n * '/my-path': myRouteRef,\n * \\}\n * \\})\n * // ...\n * const link = useRouteRef(myRouteRef)\n */\n mountedRoutes?: { [path: string]: RouteRef | ExternalRouteRef };\n\n /**\n * Components to be forwarded to the `components` option of `createApp`.\n */\n components?: Partial<AppComponents>;\n\n /**\n * Icons to be forwarded to the `icons` option of `createApp`.\n */\n icons?: Partial<AppIcons> & {\n [key in string]: IconComponent;\n };\n};\n\nfunction isExternalRouteRef(\n routeRef: RouteRef | ExternalRouteRef,\n): routeRef is ExternalRouteRef {\n // TODO(Rugvip): Least ugly workaround for now, but replace :D\n return String(routeRef).includes('{type=external,');\n}\n\n/**\n * Creates a Wrapper component that wraps a component inside a Backstage test app,\n * providing a mocked theme and app context, along with mocked APIs.\n *\n * @param options - Additional options for the rendering.\n * @public\n */\nexport function createTestAppWrapper(\n options: TestAppOptions = {},\n): (props: { children: ReactNode }) => JSX.Element {\n const { routeEntries = ['/'] } = options;\n const boundRoutes = new Map<ExternalRouteRef, RouteRef>();\n\n const app = createSpecializedApp({\n apis: mockApis,\n defaultApis,\n // Bit of a hack to make sure that the default config loader isn't used\n // as that would force every single test to wait for config loading.\n configLoader: false as unknown as undefined,\n components: {\n Progress,\n BootErrorPage,\n NotFoundErrorPage,\n ErrorBoundaryFallback,\n Router: ({ children }) => (\n <MemoryRouter initialEntries={routeEntries} children={children} />\n ),\n ...options.components,\n },\n icons: {\n ...mockIcons,\n ...options.icons,\n },\n plugins: [],\n themes: [\n {\n id: 'light',\n title: 'Test App Theme',\n variant: 'light',\n Provider: ({ children }) => (\n <UnifiedThemeProvider theme={themes.light}>\n {children}\n </UnifiedThemeProvider>\n ),\n },\n ],\n bindRoutes: ({ bind }) => {\n for (const [externalRef, absoluteRef] of boundRoutes) {\n bind(\n { ref: externalRef },\n {\n ref: absoluteRef,\n },\n );\n }\n },\n });\n\n const routeElements = Object.entries(options.mountedRoutes ?? {}).map(\n ([path, routeRef]) => {\n const Page = () => <div>Mounted at {path}</div>;\n\n // Allow external route refs to be bound to paths as well, for convenience.\n // We work around it by creating and binding an absolute ref to the external one.\n if (isExternalRouteRef(routeRef)) {\n const absoluteRef = createRouteRef({ id: 'id' });\n boundRoutes.set(routeRef, absoluteRef);\n attachComponentData(Page, 'core.mountPoint', absoluteRef);\n } else {\n attachComponentData(Page, 'core.mountPoint', routeRef);\n }\n return <Route key={path} path={path} element={<Page />} />;\n },\n );\n\n const AppProvider = app.getProvider();\n const AppRouter = app.getRouter();\n\n const TestAppWrapper = ({ children }: { children: ReactNode }) => (\n <AppProvider>\n <AppRouter>\n <NoRender>{routeElements}</NoRender>\n {children}\n </AppRouter>\n </AppProvider>\n );\n\n return TestAppWrapper;\n}\n\n/**\n * Wraps a component inside a Backstage test app, providing a mocked theme\n * and app context, along with mocked APIs.\n *\n * @param Component - A component or react node to render inside the test app.\n * @param options - Additional options for the rendering.\n * @public\n */\nexport function wrapInTestApp(\n Component: ComponentType | ReactNode,\n options: TestAppOptions = {},\n): ReactElement {\n const TestAppWrapper = createTestAppWrapper(options);\n\n let wrappedElement: React.ReactElement;\n if (Component instanceof Function) {\n wrappedElement = React.createElement(Component as ComponentType);\n } else {\n wrappedElement = Component as React.ReactElement;\n }\n\n return <TestAppWrapper>{wrappedElement}</TestAppWrapper>;\n}\n\n/**\n * Renders a component inside a Backstage test app, providing a mocked theme\n * and app context, along with mocked APIs.\n *\n * The render executes async effects similar to `renderWithEffects`. To avoid this\n * behavior, use a regular `render()` + `wrapInTestApp()` instead.\n *\n * @param Component - A component or react node to render inside the test app.\n * @param options - Additional options for the rendering.\n * @public\n */\nexport async function renderInTestApp(\n Component: ComponentType<PropsWithChildren<{}>> | ReactNode,\n options: TestAppOptions & LegacyRootOption = {},\n): Promise<RenderResult> {\n let wrappedElement: React.ReactElement;\n if (Component instanceof Function) {\n wrappedElement = React.createElement(Component as ComponentType);\n } else {\n wrappedElement = Component as React.ReactElement;\n }\n const { legacyRoot } = options;\n\n return renderWithEffects(wrappedElement, {\n wrapper: createTestAppWrapper(options),\n legacyRoot,\n });\n}\n\n/**\n * Returns a `@testing-library/react` valid MatcherFunction for supplied text\n *\n * @param string - text Text to match by element's textContent\n *\n * @public\n */\nexport const textContentMatcher =\n (text: string): MatcherFunction =>\n (_, node) => {\n if (!node) {\n return false;\n }\n\n const hasText = (textNode: Element) =>\n textNode?.textContent?.includes(text) ?? false;\n const childrenDontHaveText = (containerNode: Element) =>\n Array.from(containerNode?.children).every(child => !hasText(child));\n\n return hasText(node) && childrenDontHaveText(node);\n };\n"],"names":[],"mappings":";;;;;;;;;;AAwCA,MAAM,SAAY,GAAA;AAAA,EAChB,UAAY,EAAA,QAAA;AAAA,EACZ,gBAAkB,EAAA,QAAA;AAAA,EAClB,aAAe,EAAA,QAAA;AAAA,EACf,YAAc,EAAA,QAAA;AAAA,EACd,eAAiB,EAAA,QAAA;AAAA,EACjB,aAAe,EAAA,QAAA;AAAA,EACf,WAAa,EAAA,QAAA;AAAA,EACb,eAAiB,EAAA,QAAA;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A;AAAA,GAC1D,MAAA;AACL,IAAiB,cAAA,GAAA,SAAA;AAAA;AAGnB,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,sBAAgB,cAAe,CAAA;AACzC;AAaA,eAAsB,eACpB,CAAA,SAAA,EACA,OAA6C,GAAA,EACtB,EAAA;AACvB,EAAI,IAAA,cAAA;AACJ,EAAA,IAAI,qBAAqB,QAAU,EAAA;AACjC,IAAiB,cAAA,GAAA,KAAA,CAAM,cAAc,SAA0B,CAAA;AAAA,GAC1D,MAAA;AACL,IAAiB,cAAA,GAAA,SAAA;AAAA;AAEnB,EAAM,MAAA,EAAE,YAAe,GAAA,OAAA;AAEvB,EAAA,OAAO,kBAAkB,cAAgB,EAAA;AAAA,IACvC,OAAA,EAAS,qBAAqB,OAAO,CAAA;AAAA,IACrC;AAAA,GACD,CAAA;AACH;AASO,MAAM,kBACX,GAAA,CAAC,IACD,KAAA,CAAC,GAAG,IAAS,KAAA;AACX,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,KAAA;AAAA;AAGT,EAAA,MAAM,UAAU,CAAC,QAAA,KACf,UAAU,WAAa,EAAA,QAAA,CAAS,IAAI,CAAK,IAAA,KAAA;AAC3C,EAAA,MAAM,oBAAuB,GAAA,CAAC,aAC5B,KAAA,KAAA,CAAM,IAAK,CAAA,aAAA,EAAe,QAAQ,CAAA,CAAE,KAAM,CAAA,CAAA,KAAA,KAAS,CAAC,OAAA,CAAQ,KAAK,CAAC,CAAA;AAEpE,EAAA,OAAO,OAAQ,CAAA,IAAI,CAAK,IAAA,oBAAA,CAAqB,IAAI,CAAA;AACnD;;;;"}
|
|
1
|
+
{"version":3,"file":"appWrappers.esm.js","sources":["../../src/testUtils/appWrappers.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentType,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n createElement,\n} from 'react';\nimport { MemoryRouter, Route } from 'react-router-dom';\nimport { themes, UnifiedThemeProvider } from '@backstage/theme';\nimport MockIcon from '@material-ui/icons/AcUnit';\nimport { AppIcons, createSpecializedApp } from '@backstage/core-app-api';\nimport {\n AppComponents,\n attachComponentData,\n BootErrorPageProps,\n createRouteRef,\n ExternalRouteRef,\n IconComponent,\n RouteRef,\n} from '@backstage/core-plugin-api';\nimport { MatcherFunction, RenderResult } from '@testing-library/react';\nimport { LegacyRootOption, renderWithEffects } from './testingLibrary';\nimport { defaultApis } from './defaultApis';\nimport { mockApis } from './mockApis';\n\nconst mockIcons = {\n 'kind:api': MockIcon,\n 'kind:component': MockIcon,\n 'kind:domain': MockIcon,\n 'kind:group': MockIcon,\n 'kind:location': MockIcon,\n 'kind:system': MockIcon,\n 'kind:user': MockIcon,\n 'kind:resource': MockIcon,\n 'kind:template': MockIcon,\n\n brokenImage: MockIcon,\n catalog: MockIcon,\n scaffolder: MockIcon,\n techdocs: MockIcon,\n search: MockIcon,\n chat: MockIcon,\n dashboard: MockIcon,\n docs: MockIcon,\n email: MockIcon,\n github: MockIcon,\n group: MockIcon,\n help: MockIcon,\n user: MockIcon,\n warning: MockIcon,\n star: MockIcon,\n unstarred: MockIcon,\n};\n\nconst ErrorBoundaryFallback = ({ error }: { error: Error }) => {\n throw new Error(`Reached ErrorBoundaryFallback Page with error, ${error}`);\n};\nconst NotFoundErrorPage = () => {\n throw new Error('Reached NotFound Page');\n};\nconst BootErrorPage = ({ step, error }: BootErrorPageProps) => {\n throw new Error(`Reached BootError Page at step ${step} with error ${error}`);\n};\nconst Progress = () => <div data-testid=\"progress\" />;\n\nconst NoRender = (_props: { children: ReactNode }) => null;\n\n/**\n * Options to customize the behavior of the test app wrapper.\n * @public\n */\nexport type TestAppOptions = {\n /**\n * Initial route entries to pass along as `initialEntries` to the router.\n */\n routeEntries?: string[];\n\n /**\n * An object of paths to mount route ref on, with the key being the path and the value\n * being the RouteRef that the path will be bound to. This allows the route refs to be\n * used by `useRouteRef` in the rendered elements.\n *\n * @example\n * wrapInTestApp(<MyComponent />, \\{\n * mountedRoutes: \\{\n * '/my-path': myRouteRef,\n * \\}\n * \\})\n * // ...\n * const link = useRouteRef(myRouteRef)\n */\n mountedRoutes?: { [path: string]: RouteRef | ExternalRouteRef };\n\n /**\n * Components to be forwarded to the `components` option of `createApp`.\n */\n components?: Partial<AppComponents>;\n\n /**\n * Icons to be forwarded to the `icons` option of `createApp`.\n */\n icons?: Partial<AppIcons> & {\n [key in string]: IconComponent;\n };\n};\n\nfunction isExternalRouteRef(\n routeRef: RouteRef | ExternalRouteRef,\n): routeRef is ExternalRouteRef {\n // TODO(Rugvip): Least ugly workaround for now, but replace :D\n return String(routeRef).includes('{type=external,');\n}\n\n/**\n * Creates a Wrapper component that wraps a component inside a Backstage test app,\n * providing a mocked theme and app context, along with mocked APIs.\n *\n * @param options - Additional options for the rendering.\n * @public\n */\nexport function createTestAppWrapper(\n options: TestAppOptions = {},\n): (props: { children: ReactNode }) => JSX.Element {\n const { routeEntries = ['/'] } = options;\n const boundRoutes = new Map<ExternalRouteRef, RouteRef>();\n\n const app = createSpecializedApp({\n apis: mockApis,\n defaultApis,\n // Bit of a hack to make sure that the default config loader isn't used\n // as that would force every single test to wait for config loading.\n configLoader: false as unknown as undefined,\n components: {\n Progress,\n BootErrorPage,\n NotFoundErrorPage,\n ErrorBoundaryFallback,\n Router: ({ children }) => (\n <MemoryRouter initialEntries={routeEntries} children={children} />\n ),\n ...options.components,\n },\n icons: {\n ...mockIcons,\n ...options.icons,\n },\n plugins: [],\n themes: [\n {\n id: 'light',\n title: 'Test App Theme',\n variant: 'light',\n Provider: ({ children }) => (\n <UnifiedThemeProvider theme={themes.light}>\n {children}\n </UnifiedThemeProvider>\n ),\n },\n ],\n bindRoutes: ({ bind }) => {\n for (const [externalRef, absoluteRef] of boundRoutes) {\n bind(\n { ref: externalRef },\n {\n ref: absoluteRef,\n },\n );\n }\n },\n });\n\n const routeElements = Object.entries(options.mountedRoutes ?? {}).map(\n ([path, routeRef]) => {\n const Page = () => <div>Mounted at {path}</div>;\n\n // Allow external route refs to be bound to paths as well, for convenience.\n // We work around it by creating and binding an absolute ref to the external one.\n if (isExternalRouteRef(routeRef)) {\n const absoluteRef = createRouteRef({ id: 'id' });\n boundRoutes.set(routeRef, absoluteRef);\n attachComponentData(Page, 'core.mountPoint', absoluteRef);\n } else {\n attachComponentData(Page, 'core.mountPoint', routeRef);\n }\n return <Route key={path} path={path} element={<Page />} />;\n },\n );\n\n const AppProvider = app.getProvider();\n const AppRouter = app.getRouter();\n\n const TestAppWrapper = ({ children }: { children: ReactNode }) => (\n <AppProvider>\n <AppRouter>\n <NoRender>{routeElements}</NoRender>\n {children}\n </AppRouter>\n </AppProvider>\n );\n\n return TestAppWrapper;\n}\n\n/**\n * Wraps a component inside a Backstage test app, providing a mocked theme\n * and app context, along with mocked APIs.\n *\n * @param Component - A component or react node to render inside the test app.\n * @param options - Additional options for the rendering.\n * @public\n */\nexport function wrapInTestApp(\n Component: ComponentType | ReactNode,\n options: TestAppOptions = {},\n): ReactElement {\n const TestAppWrapper = createTestAppWrapper(options);\n\n let wrappedElement: ReactElement;\n if (Component instanceof Function) {\n wrappedElement = createElement(Component as ComponentType);\n } else {\n wrappedElement = Component as ReactElement;\n }\n\n return <TestAppWrapper>{wrappedElement}</TestAppWrapper>;\n}\n\n/**\n * Renders a component inside a Backstage test app, providing a mocked theme\n * and app context, along with mocked APIs.\n *\n * The render executes async effects similar to `renderWithEffects`. To avoid this\n * behavior, use a regular `render()` + `wrapInTestApp()` instead.\n *\n * @param Component - A component or react node to render inside the test app.\n * @param options - Additional options for the rendering.\n * @public\n */\nexport async function renderInTestApp(\n Component: ComponentType<PropsWithChildren<{}>> | ReactNode,\n options: TestAppOptions & LegacyRootOption = {},\n): Promise<RenderResult> {\n let wrappedElement: ReactElement;\n if (Component instanceof Function) {\n wrappedElement = createElement(Component as ComponentType);\n } else {\n wrappedElement = Component as ReactElement;\n }\n const { legacyRoot } = options;\n\n return renderWithEffects(wrappedElement, {\n wrapper: createTestAppWrapper(options),\n legacyRoot,\n });\n}\n\n/**\n * Returns a `@testing-library/react` valid MatcherFunction for supplied text\n *\n * @param string - text Text to match by element's textContent\n *\n * @public\n */\nexport const textContentMatcher =\n (text: string): MatcherFunction =>\n (_, node) => {\n if (!node) {\n return false;\n }\n\n const hasText = (textNode: Element) =>\n textNode?.textContent?.includes(text) ?? false;\n const childrenDontHaveText = (containerNode: Element) =>\n Array.from(containerNode?.children).every(child => !hasText(child));\n\n return hasText(node) && childrenDontHaveText(node);\n };\n"],"names":[],"mappings":";;;;;;;;;;;AAyCA,MAAM,SAAY,GAAA;AAAA,EAChB,UAAY,EAAA,QAAA;AAAA,EACZ,gBAAkB,EAAA,QAAA;AAAA,EAClB,aAAe,EAAA,QAAA;AAAA,EACf,YAAc,EAAA,QAAA;AAAA,EACd,eAAiB,EAAA,QAAA;AAAA,EACjB,aAAe,EAAA,QAAA;AAAA,EACf,WAAa,EAAA,QAAA;AAAA,EACb,eAAiB,EAAA,QAAA;AAAA,EACjB,eAAiB,EAAA,QAAA;AAAA,EAEjB,WAAa,EAAA,QAAA;AAAA,EACb,OAAS,EAAA,QAAA;AAAA,EACT,UAAY,EAAA,QAAA;AAAA,EACZ,QAAU,EAAA,QAAA;AAAA,EACV,MAAQ,EAAA,QAAA;AAAA,EACR,IAAM,EAAA,QAAA;AAAA,EACN,SAAW,EAAA,QAAA;AAAA,EACX,IAAM,EAAA,QAAA;AAAA,EACN,KAAO,EAAA,QAAA;AAAA,EACP,MAAQ,EAAA,QAAA;AAAA,EACR,KAAO,EAAA,QAAA;A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AAEvB,EAAA,OAAO,kBAAkB,cAAgB,EAAA;AAAA,IACvC,OAAA,EAAS,qBAAqB,OAAO,CAAA;AAAA,IACrC;AAAA,GACD,CAAA;AACH;AASO,MAAM,kBACX,GAAA,CAAC,IACD,KAAA,CAAC,GAAG,IAAS,KAAA;AACX,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,KAAA;AAAA;AAGT,EAAA,MAAM,UAAU,CAAC,QAAA,KACf,UAAU,WAAa,EAAA,QAAA,CAAS,IAAI,CAAK,IAAA,KAAA;AAC3C,EAAA,MAAM,oBAAuB,GAAA,CAAC,aAC5B,KAAA,KAAA,CAAM,IAAK,CAAA,aAAA,EAAe,QAAQ,CAAA,CAAE,KAAM,CAAA,CAAA,KAAA,KAAS,CAAC,OAAA,CAAQ,KAAK,CAAC,CAAA;AAEpE,EAAA,OAAO,OAAQ,CAAA,IAAI,CAAK,IAAA,oBAAA,CAAqB,IAAI,CAAA;AACnD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/test-utils",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7-next.0",
|
|
4
4
|
"description": "Utilities to test Backstage plugins and apps.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library"
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"types": "./dist/index.d.ts",
|
|
37
37
|
"typesVersions": {
|
|
38
38
|
"*": {
|
|
39
|
-
"*": [
|
|
40
|
-
"dist/index.d.ts"
|
|
41
|
-
],
|
|
42
39
|
"alpha": [
|
|
43
40
|
"dist/alpha.d.ts"
|
|
41
|
+
],
|
|
42
|
+
"package.json": [
|
|
43
|
+
"package.json"
|
|
44
44
|
]
|
|
45
45
|
}
|
|
46
46
|
},
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@backstage/config": "1.3.2",
|
|
61
|
-
"@backstage/core-app-api": "1.16.
|
|
62
|
-
"@backstage/core-plugin-api": "1.10.
|
|
61
|
+
"@backstage/core-app-api": "1.16.1-next.0",
|
|
62
|
+
"@backstage/core-plugin-api": "1.10.6-next.0",
|
|
63
63
|
"@backstage/plugin-permission-common": "0.8.4",
|
|
64
|
-
"@backstage/plugin-permission-react": "0.4.
|
|
65
|
-
"@backstage/theme": "0.6.
|
|
64
|
+
"@backstage/plugin-permission-react": "0.4.33-next.0",
|
|
65
|
+
"@backstage/theme": "0.6.5-next.0",
|
|
66
66
|
"@backstage/types": "1.2.1",
|
|
67
67
|
"@material-ui/core": "^4.12.2",
|
|
68
68
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"zen-observable": "^0.10.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@backstage/cli": "0.
|
|
74
|
+
"@backstage/cli": "0.32.0-next.2",
|
|
75
75
|
"@testing-library/jest-dom": "^6.0.0",
|
|
76
76
|
"@types/jest": "*",
|
|
77
77
|
"@types/react": "^18.0.0",
|