Skip to content

Commit

Permalink
refactor: update @scality/module-federation mock to use actual router…
Browse files Browse the repository at this point in the history
…'s useNavigate
  • Loading branch information
hervedombya committed Jan 20, 2025
1 parent 27da2a9 commit c3518e0
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions jestSetupAfterEnv.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,16 @@ jest.mock('./src/react/next-architecture/ui/XCoreLibraryProvider', () => {

jest.mock('@module-federation/enhanced/runtime', () => {}, { virtual: true });

jest.mock('@scality/module-federation', () => ({
useCurrentApp: () => ({
name: 'zenko-ui',
appHistoryBasePath: '',
}),
ShellHooksProvider: ({ children }) => <>{children}</>,
useShellHooks: () => mockShellHooks,
useShellAlerts: () => mockShellAlerts,
useBasenameRelativeNavigate: jest.fn(() => jest.fn()),
}));
jest.mock('@scality/module-federation', () => {
const router = jest.requireActual('react-router');
return {
useCurrentApp: () => ({
name: 'zenko-ui',
appHistoryBasePath: '',
}),
ShellHooksProvider: ({ children }) => <>{children}</>,
useShellHooks: () => mockShellHooks,
useShellAlerts: () => mockShellAlerts,
useBasenameRelativeNavigate: router.useNavigate,
};
});

0 comments on commit c3518e0

Please sign in to comment.