diff --git a/src/routes.test.tsx b/src/routes.test.tsx
index 0ed942c8..0fbd0b18 100644
--- a/src/routes.test.tsx
+++ b/src/routes.test.tsx
@@ -1,4 +1,3 @@
-import { Suspense } from 'react';
import { screen } from '@testing-library/react';
import { authenticatedLoader } from '@openedx/frontend-base';
import { renderWrapper, initializeMocks } from '@src/testUtils';
@@ -27,24 +26,16 @@ describe('routes', () => {
it('requires authentication via the authenticated loader', () => {
expect(routes[0].loader).toBe(authenticatedLoader);
});
-
- it('provides a Component for the route', () => {
- expect(routes[0].Component).toBeDefined();
- });
});
- describe('Component', () => {
+ describe('lazy', () => {
beforeEach(() => {
initializeMocks();
});
- it('lazily loads Main', async () => {
- const { Component } = routes[0];
- renderWrapper(
- loading}>
-
- ,
- );
+ it('resolves Main as the route Component', async () => {
+ const { Component } = await routes[0].lazy();
+ renderWrapper();
expect(await screen.findByTestId('authz-module')).toBeInTheDocument();
});
});
diff --git a/src/routes.tsx b/src/routes.tsx
index de5d8da8..b15cfb22 100644
--- a/src/routes.tsx
+++ b/src/routes.tsx
@@ -1,16 +1,16 @@
-import { lazy } from 'react';
import { authenticatedLoader } from '@openedx/frontend-base';
import { AUTHZ_HOME_PATH } from './authz-module/constants';
-const Main = lazy(() => import('./Main'));
-
const routes = [
{
id: 'org.openedx.frontend.route.adminConsole.main',
path: `${AUTHZ_HOME_PATH}/*`,
loader: authenticatedLoader,
- Component: Main,
+ async lazy() {
+ const { default: Main } = await import('./Main');
+ return { Component: Main };
+ },
handle: {
roles: ['org.openedx.frontend.role.adminConsole'],
},