Skip to content

Commit

Permalink
Add attachments mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
brandones committed Dec 23, 2023
1 parent 6537b2b commit dc52dcc
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/framework/esm-framework/mock.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import type {} from '@openmrs/esm-globals';
import { createStore, StoreApi } from 'zustand';
import { createStore, type StoreApi } from 'zustand';
import { NEVER, of } from 'rxjs';
import { interpolateUrl } from '@openmrs/esm-config';
import { SessionStore } from '@openmrs/esm-api';
import { type SessionStore } from '@openmrs/esm-api';
export { parseDate, formatDate, formatDatetime, formatTime, age } from '@openmrs/esm-utils';
export { interpolateString, interpolateUrl, validators, validator } from '@openmrs/esm-config';

Expand Down Expand Up @@ -56,6 +56,16 @@ export const newWorkspaceItem = jest.fn();

export const fhirBaseUrl = '/ws/fhir2/R4';

export const attachmentUrl = '/ws/rest/v1/attachment';

export const getAttachmentByUuid = jest.fn();

export const getAttachments = jest.fn();

export const createAttachment = jest.fn();

export const deleteAttachmentPermanently = jest.fn();

/* esm-state */
interface StoreEntity {
value: StoreApi<any>;
Expand Down Expand Up @@ -205,6 +215,14 @@ export const ComponentContext = React.createContext(null);

export const openmrsComponentDecorator = jest.fn().mockImplementation(() => (component) => component);

export const useAttachments = jest.fn(() => ({
isLoading: true,
data: [],
error: null,
mutate: jest.fn(),
isValidating: true,
}));

export const useCurrentPatient = jest.fn(() => []);

export const usePatient = jest.fn(() => ({
Expand Down

0 comments on commit dc52dcc

Please sign in to comment.