Skip to content

Commit

Permalink
(fix) Mock fixes (#956)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandones authored Mar 13, 2024
1 parent 923761f commit 86f8bc8
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/framework/esm-framework/mock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,8 @@ export const useExtensionStore = getExtensionStore();

export const useFeatureFlag = jest.fn().mockReturnValue(true);

export const usePagination = jest.fn().mockImplementation(() => ({
currentPage: 1,
goTo: () => {},
results: [],
}));
import { usePagination as realUsePagination } from '@openmrs/esm-react-utils';
export const usePagination = jest.fn(realUsePagination);

export const useVisit = jest.fn().mockReturnValue({
error: null,
Expand Down Expand Up @@ -258,9 +255,9 @@ export const useAbortController = jest.fn().mockReturnValue(() => {
);
});

export function useOpenmrsSWR(key: string | Array<any>) {
export const useOpenmrsSWR = jest.fn((key: string | Array<any>) => {
return { data: openmrsFetch(key.toString()) };
}
});

export const useDebounce = jest.fn().mockImplementation((value) => value);

Expand All @@ -278,10 +275,11 @@ export const setLeftNav = jest.fn();
export const unsetLeftNav = jest.fn();
export const ResponsiveWrapper = jest.fn(({ children }) => <>{children}</>);
export const OpenmrsDatePicker = jest.fn(() => <div>OpenMRS DatePicker</div>);
export const ErrorState = jest.fn(() => <div>Error State</div>);

export const CustomOverflowMenu = jest.fn(({ children }) => (
export const CustomOverflowMenu = jest.fn(({ menuTitle, children }) => (
<div>
<button>Custom Overflow Menu</button>
<button>{menuTitle}</button>
{children}
</div>
));
Expand Down

0 comments on commit 86f8bc8

Please sign in to comment.