1- import { launchClinicalViewForm , mealSymbol , getPatientEncounterDates } from './helpers' ;
2- import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib' ;
3- import { openmrsFetch } from '@openmrs/esm-framework' ;
1+ import { launchWorkspace , openmrsFetch } from '@openmrs/esm-framework' ;
42import dayjs from 'dayjs' ;
3+ import { launchClinicalViewForm , mealSymbol , getPatientEncounterDates } from './helpers' ;
54import { dateFormat } from '../constants' ;
65
76jest . mock ( '@openmrs/esm-patient-common-lib' , ( ) => ( {
8- launchPatientWorkspace : jest . fn ( ) ,
7+ launchWorkspace : jest . fn ( ) ,
98} ) ) ;
109
1110jest . mock ( '@openmrs/esm-framework' , ( ) => ( {
@@ -14,15 +13,15 @@ jest.mock('@openmrs/esm-framework', () => ({
1413} ) ) ;
1514
1615describe ( 'launchClinicalViewForm' , ( ) => {
17- it ( 'should call launchPatientWorkspace with correct parameters' , ( ) => {
16+ it ( 'should call launchWorkspace with correct parameters' , ( ) => {
1817 const form = { name : 'Test Form' } as any ;
1918 const patientUuid = 'patient-uuid' ;
2019 const onFormSave = jest . fn ( ) ;
2120 const action = 'add' ;
2221
2322 launchClinicalViewForm ( form , patientUuid , onFormSave , action ) ;
2423
25- expect ( launchPatientWorkspace ) . toHaveBeenCalledWith ( 'patient-form-entry-workspace' , {
24+ expect ( launchWorkspace ) . toHaveBeenCalledWith ( 'patient-form-entry-workspace' , {
2625 workspaceTitle : form . name ,
2726 mutateForm : onFormSave ,
2827 formInfo : {
@@ -44,10 +43,10 @@ describe('launchClinicalViewForm', () => {
4443describe ( 'mealSymbol' , ( ) => {
4544 it . each ( [
4645 [ '0%' , '-' ] ,
47- [ '25%' , '+ ' ] ,
48- [ '50%' , '++ ' ] ,
49- [ '75%' , '+++ ' ] ,
50- [ '100%' , '++++ ' ] ,
46+ [ '25%' , 'X ' ] ,
47+ [ '50%' , 'XX ' ] ,
48+ [ '75%' , 'XXX ' ] ,
49+ [ '100%' , 'XXXX ' ] ,
5150 [ 'unknown' , '' ] ,
5251 ] ) ( 'should return correct symbol for %s' , ( input , expected ) => {
5352 expect ( mealSymbol ( input ) ) . toBe ( expected ) ;
0 commit comments