From dc52dccbdf060f9bacf379c85e8203276febff4f Mon Sep 17 00:00:00 2001 From: Brandon Istenes Date: Sat, 23 Dec 2023 14:10:13 -0500 Subject: [PATCH] Add attachments mocks --- packages/framework/esm-framework/mock.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/framework/esm-framework/mock.tsx b/packages/framework/esm-framework/mock.tsx index d6b5149fd..c490e89ee 100644 --- a/packages/framework/esm-framework/mock.tsx +++ b/packages/framework/esm-framework/mock.tsx @@ -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'; @@ -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; @@ -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(() => ({