diff --git a/.changeset/gentle-lemons-explain.md b/.changeset/gentle-lemons-explain.md
new file mode 100644
index 0000000000..435ca4003b
--- /dev/null
+++ b/.changeset/gentle-lemons-explain.md
@@ -0,0 +1,5 @@
+---
+'@backstage/frontend-test-utils': patch
+---
+
+Added a `initialRouteEntries` option to `renderInTestApp`.
diff --git a/.changeset/gentle-students-glow.md b/.changeset/gentle-students-glow.md
new file mode 100644
index 0000000000..ade77cbb95
--- /dev/null
+++ b/.changeset/gentle-students-glow.md
@@ -0,0 +1,5 @@
+---
+'@backstage/frontend-test-utils': patch
+---
+
+The `renderInTestApp` helper now provides a default mock config with mock values for both `app.baseUrl` and `backend.baseUrl`.
diff --git a/packages/frontend-test-utils/src/app/renderInTestApp.tsx b/packages/frontend-test-utils/src/app/renderInTestApp.tsx
index cd9f4439b3..1643b06fac 100644
--- a/packages/frontend-test-utils/src/app/renderInTestApp.tsx
+++ b/packages/frontend-test-utils/src/app/renderInTestApp.tsx
@@ -36,6 +36,11 @@ import {
} from '@backstage/frontend-plugin-api';
import appPlugin from '@backstage/plugin-app';
+const DEFAULT_MOCK_CONFIG = {
+ app: { baseUrl: 'http://localhost:3000' },
+ backend: { baseUrl: 'http://localhost:7007' },
+};
+
/**
* Options to customize the behavior of the test app.
* @public
@@ -73,6 +78,11 @@ export type TestAppOptions = {
* Additional features to add to the test app.
*/
features?: FrontendFeature[];
+
+ /**
+ * Initial route entries to use for the router.
+ */
+ initialRouteEntries?: string[];
};
const NavItem = (props: {
@@ -150,7 +160,11 @@ export function renderInTestApp(
}),
RouterBlueprint.make({
params: {
- Component: ({ children }) => {children},
+ Component: ({ children }) => (
+
+ {children}
+
+ ),
},
}),
];
@@ -197,7 +211,10 @@ export function renderInTestApp(
const app = createSpecializedApp({
features,
config: ConfigReader.fromConfigs([
- { context: 'render-config', data: options?.config ?? {} },
+ {
+ context: 'render-config',
+ data: options?.config ?? DEFAULT_MOCK_CONFIG,
+ },
]),
});