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.alt} + {logo.alt} ) : 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 = () =>
Icon
; -export const AddIcon = () =>
Icon
; -export const ArrowDownIcon = () =>
Icon
; -export const ArrowLeftIcon = () =>
Icon
; -export const ArrowRightIcon = () =>
Icon
; -export const ArrowUpIcon = () =>
Icon
; -export const ChartAverageIcon = () =>
Icon
; -export const ChemistryIcon = () =>
Icon
; -export const ChevronDownIcon = () =>
Icon
; -export const ChevronLeftIcon = () =>
Icon
; -export const ChevronRightIcon = () =>
Icon
; -export const ChevronUpIcon = () =>
Icon
; -export const CloseFilledIcon = () =>
Icon
; -export const CloseIcon = () =>
Icon
; -export const CloseOutlineIcon = () =>
Icon
; -export const DownloadIcon = () =>
Icon
; -export const EditIcon = () =>
Icon
; -export const ImageMedicalIcon = () =>
Icon
; -export const RadiologyIcon = () =>
Icon
; -export const ListCheckedIcon = () =>
Icon
; -export const ConditionsIcon = () =>
Icon
; -export const LocationIcon = () =>
Icon
; -export const MoneyIcon = () =>
Icon
; -export const MicroscopeIcon = () =>
Icon
; -export const ResetIcon = () =>
Icon
; -export const TranslateIcon = () =>
Icon
; -export const SaveIcon = () =>
Icon
; -export const SearchIcon = () =>
Icon
; -export const SwitcherIcon = () =>
Icon
; -export const ShoppingCartIcon = () =>
Icon
; -export const ShoppingCartArrowDownIcon = () =>
Icon
; -export const ShoppingCartAddItemIcon = () =>
Icon
; -export const TimeIcon = () =>
Icon
; -export const ToolsIcon = () =>
Icon
; -export const TrashCanIcon = () =>
Icon
; -export const UserAvatarIcon = () =>
Icon
; -export const UserXrayIcon = () =>
Icon
; -export const WarningIcon = () =>
Icon
; -export const AllergiesIcon = () =>
Icon
; +export const ActivityIcon = () =>
ActivityIcon
; +export const AddIcon = () =>
AddIcon
; +export const ArrowDownIcon = () =>
ArrowDownIcon
; +export const ArrowLeftIcon = () =>
ArrowLeftIcon
; +export const ArrowRightIcon = () =>
ArrowRightIcon
; +export const ArrowUpIcon = () =>
ArrowUpIcon
; +export const ChartAverageIcon = () =>
ChartAverageIcon
; +export const ChemistryIcon = () =>
ChemistryIcon
; +export const ChevronDownIcon = () =>
ChevronDownIcon
; +export const ChevronLeftIcon = () =>
ChevronLeftIcon
; +export const ChevronRightIcon = () =>
ChevronRightIcon
; +export const ChevronUpIcon = () =>
ChevronUpIcon
; +export const CloseFilledIcon = () =>
CloseFilledIcon
; +export const CloseIcon = () =>
CloseIcon
; +export const CloseOutlineIcon = () =>
CloseOutlineIcon
; +export const DownloadIcon = () =>
DownloadIcon
; +export const EditIcon = () =>
EditIcon
; +export const ImageMedicalIcon = () =>
ImageMedicalIcon
; +export const RadiologyIcon = () =>
RadiologyIcon
; +export const ListCheckedIcon = () =>
ListCheckedIcon
; +export const ConditionsIcon = () =>
ConditionsIcon
; +export const LocationIcon = () =>
LocationIcon
; +export const MoneyIcon = () =>
MoneyIcon
; +export const MicroscopeIcon = () =>
MicroscopeIcon
; +export const ResetIcon = () =>
ResetIcon
; +export const TranslateIcon = () =>
TranslateIcon
; +export const SaveIcon = () =>
SaveIcon
; +export const SearchIcon = () =>
SearchIcon
; +export const SwitcherIcon = () =>
SwitcherIcon
; +export const ShoppingCartIcon = () =>
ShoppingCartIcon
; +export const ShoppingCartArrowDownIcon = () =>
ShoppingCartArrowDownIcon
; +export const ShoppingCartAddItemIcon = () =>
ShoppingCartAddItemIcon
; +export const TimeIcon = () =>
TimeIcon
; +export const ToolsIcon = () =>
ToolsIcon
; +export const TrashCanIcon = () =>
TrashCanIcon
; +export const UserAvatarIcon = () =>
UserAvatarIcon
; +export const UserXrayIcon = () =>
UserXrayIcon
; +export const WarningIcon = () =>
WarningIcon
; +export const AllergiesIcon = () =>
AllergiesIcon
; export const Icon = () =>
Icon
;