Add initialRouteEntries to fix flaky entity page test

The entity page resolves route params via useRouteRefParams. Without
initialRouteEntries, the MemoryRouter starts at '/' which doesn't
match the entity route pattern. On fast machines the mock entity
resolves before the useEffect error check fires, but on slow CI
runners the timing differs and the "No name provided!" error path
wins, causing the test to flake.

Adding initialRouteEntries ensures the router starts at a URL that
matches /catalog/:namespace/:kind/:name, so route params are always
available regardless of timing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-05-20 08:41:04 +02:00
parent 479d78ed5c
commit a58bcdcb47
+15
View File
@@ -156,6 +156,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -203,6 +204,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -243,6 +245,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -296,6 +299,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -337,6 +341,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -371,6 +376,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -417,6 +423,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -453,6 +460,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -494,6 +502,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -543,6 +552,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -592,6 +602,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -629,6 +640,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -668,6 +680,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -727,6 +740,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',
@@ -782,6 +796,7 @@ describe('Entity page', () => {
[catalogApiRef, mockCatalogApi],
[starredEntitiesApiRef, mockStarredEntitiesApi],
],
initialRouteEntries: ['/catalog/default/component/artist-lookup'],
config: {
app: {
title: 'Custom app',