diff --git a/packages/apps/esm-primary-navigation-app/src/components/logo/logo.component.tsx b/packages/apps/esm-primary-navigation-app/src/components/logo/logo.component.tsx index a1a07e952..54d41acfd 100644 --- a/packages/apps/esm-primary-navigation-app/src/components/logo/logo.component.tsx +++ b/packages/apps/esm-primary-navigation-app/src/components/logo/logo.component.tsx @@ -7,16 +7,12 @@ const Logo: React.FC = () => { return ( <> {logo?.src ? ( - + ) : logo?.name ? ( logo.name ) : ( )} > diff --git a/packages/apps/esm-primary-navigation-app/src/root.component.test.tsx b/packages/apps/esm-primary-navigation-app/src/root.component.test.tsx index f27c44e08..fd4bb3d3d 100644 --- a/packages/apps/esm-primary-navigation-app/src/root.component.test.tsx +++ b/packages/apps/esm-primary-navigation-app/src/root.component.test.tsx @@ -10,29 +10,20 @@ import Root from './root.component'; const mockUserObservable = of(mockUser); const mockSessionObservable = of({ data: mockSession }); -jest.mock('@openmrs/esm-framework', () => ({ - openmrsFetch: jest.fn().mockResolvedValue({}), - useConnectedExtensions: jest.fn().mockReturnValue(['mock-extension']), - createErrorHandler: jest.fn(), - openmrsObservableFetch: jest.fn(), - getCurrentUser: jest.fn(() => mockUserObservable), - ExtensionSlot: jest.fn().mockImplementation(({ children }) => <>{children}>), - useLayoutType: jest.fn(() => 'tablet'), - useConfig: jest.fn(() => ({ - logo: { src: null, alt: null, name: 'Mock EMR' }, - })), - useOnClickOutside: jest.fn(() => { - const { useRef } = require('react'); - return useRef(); - }), - useSession: jest.fn().mockReturnValue(mockSession), - refetchCurrentUser: jest.fn(), - subscribeConnectivity: jest.fn(), - navigate: jest.fn(), - ConfigurableLink: jest.fn(() => { - return Mock EMR; - }), -})); +jest.mock('@openmrs/esm-framework', () => { + const framework = jest.requireActual('@openmrs/esm-framework'); + return { + ...framework, + ConfigurableLink: jest.fn(() => { + return Mock EMR; + }), + useConfig: jest.fn(() => ({ + logo: { src: null, alt: null, name: 'Mock EMR', link: 'Mock EMR' }, + })), + useConnectedExtensions: jest.fn().mockReturnValue(['mock-extension']), + useSession: jest.fn().mockReturnValue(mockSession), + }; +}); jest.mock('./root.resource', () => ({ getSynchronizedCurrentUser: jest.fn(() => mockUserObservable), diff --git a/packages/framework/esm-framework/mock.tsx b/packages/framework/esm-framework/mock.tsx index ac5a74299..600dee25e 100644 --- a/packages/framework/esm-framework/mock.tsx +++ b/packages/framework/esm-framework/mock.tsx @@ -48,6 +48,7 @@ export const goBackInHistory = jest.fn(); /* esm-offline */ export const useConnectivity = jest.fn().mockReturnValue(true); +export const subscribeConnectivity = jest.fn(); /* esm-styleguide */ export const showNotification = jest.fn(); diff --git a/packages/framework/esm-react-utils/mock.tsx b/packages/framework/esm-react-utils/mock.tsx index 3bac7b97c..ece0f35a1 100644 --- a/packages/framework/esm-react-utils/mock.tsx +++ b/packages/framework/esm-react-utils/mock.tsx @@ -4,9 +4,11 @@ import { configSchema } from '@openmrs/esm-config/mock'; import { getExtensionStore, getExtensionInternalStore } from '@openmrs/esm-extensions/mock'; import { createGlobalStore } from '@openmrs/esm-state/mock'; import { usePagination as realUsePagination } from './src/index'; -export { ConfigurableLink, isDesktop, useStore, useStoreWithActions, createUseStore } from './src/index'; +export { isDesktop, useStore, useStoreWithActions, createUseStore } from './src/index'; import * as utils from '@openmrs/esm-utils'; +export const ConfigurableLink = ({ to, children }) => {children}; + export const ComponentContext = React.createContext(null); export const openmrsComponentDecorator = jest.fn().mockImplementation(() => (component) => component); diff --git a/packages/framework/esm-styleguide/mock.tsx b/packages/framework/esm-styleguide/mock.tsx index 259d71e68..812020e9e 100644 --- a/packages/framework/esm-styleguide/mock.tsx +++ b/packages/framework/esm-styleguide/mock.tsx @@ -1,42 +1,42 @@ import React from 'react'; -export const ActivityIcon = () =>