diff --git a/shell/router/getAppRoutes.test.tsx b/shell/router/getAppRoutes.test.tsx new file mode 100644 index 00000000..fd97e1b6 --- /dev/null +++ b/shell/router/getAppRoutes.test.tsx @@ -0,0 +1,59 @@ +import { RouteObject } from 'react-router'; +import { getConfig } from '../../runtime'; +import getAppRoutes from './getAppRoutes'; + +jest.mock('../../runtime', () => ({ + getConfig: jest.fn(), +})); + +describe('getAppRoutes', () => { + it('should return an empty array when no apps are configured', () => { + (getConfig as jest.Mock).mockReturnValue({ apps: [] }); + + const routes = getAppRoutes(); + + expect(routes).toEqual([]); + }); + + it('should flatten and return routes from configured apps', () => { + const mockApps = [ + { + routes: [ + { path: '/page1', element: