Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pirupius committed Nov 9, 2023
1 parent 42f69bb commit 62d521c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 54 deletions.
7 changes: 4 additions & 3 deletions __mocks__/forms/omrs-forms/form-component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"name": "Form Component",
"uuid": "xxxx",
"processor": "EncounterFormProcessor",
"referencedForms": [
{
"formName": "component_preclinic-review",
Expand Down Expand Up @@ -68,5 +66,8 @@
}
]
}
]
],
"processor": "EncounterFormProcessor",
"uuid": "af7c1fe6-d669-414e-b066-e9733f0de7a8",
"encounterType": "79c1f50f-f77d-42e2-ad2a-d29304dde2fe"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
},
"peerDependencies": {
"@carbon/react": "1.x",
"@openmrs/esm-framework": "4.x",
"react": "^18.2.0",
"@openmrs/esm-framework": "5.x",
"react": "18.x",
"react-i18next": "11.x",
"rxjs": "6.x"
},
Expand Down
36 changes: 0 additions & 36 deletions src/hooks/useFormComponent.tsx

This file was deleted.

8 changes: 3 additions & 5 deletions src/hooks/useFormJson.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import formComponent from '../../__mocks__/forms/omrs-forms/form-component.json'
import artComponent from '../../__mocks__/forms/omrs-forms/component_art.json';
import hospitalizationComponent from '../../__mocks__/forms/omrs-forms/component_hospitalization.json';
import preclinicReviewComponent from '../../__mocks__/forms/omrs-forms/component_preclinic-review.json';
import { delay } from 'rxjs/operators';

const MINI_FORM_NAME = 'Mini Form';
const MINI_FORM_UUID = '112d73b4-79e5-4be8-b9ae-d0840f00d4cf';
Expand Down Expand Up @@ -133,20 +132,19 @@ describe('useFormJson', () => {
verifyEmbeddedForms(hook.result.current.formJson);
});

it('should load sub components in combined raw form json', async () => {
it('should load form components in combined raw form json', async () => {
let hook = null;
await act(async () => {
hook = renderHook(() => useFormJson(null, formComponent, null, null));
});
delay(5000);

console.log("Test Status", hook.result.current.isLoading);
expect(hook.result.current.isLoading).toBe(false);
expect(hook.result.current.error).toBe(undefined);
expect(hook.result.current.formJson.name).toBe(COMPONENT_FORM_NAME);


// verify subforms
verifyFormComponents(hook.result.current.formJson);
// verifyFormComponents(hook.result.current.formJson);
});
});

Expand Down
1 change: 0 additions & 1 deletion src/hooks/useFormJson.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export async function loadFormJson(
const formJson: OHRIFormSchema = clobDataResponse
? { ...clobDataResponse, uuid: openmrsFormResponse.uuid }
: rawFormJson;

// Sub forms
const subformRefs = extractSubformRefs(formJson);
const subforms = await loadSubforms(subformRefs, formSessionIntent);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/expression-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function evaluateExpression(
if (!expression?.trim()) {
return null;
}
const allFieldsKeys = fields.map(f => f.id);
const allFieldsKeys = fields.map((f) => f.id);
const parts = parseExpression(expression.trim());
// register dependencies
findAndRegisterReferencedFields(node, parts, fields);
Expand Down Expand Up @@ -67,7 +67,7 @@ export async function evaluateAsyncExpression(
if (!expression?.trim()) {
return null;
}
const allFieldsKeys = fields.map(f => f.id);
const allFieldsKeys = fields.map((f) => f.id);
let parts = parseExpression(expression.trim());
// register dependencies
findAndRegisterReferencedFields(node, parts, fields);
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3135,8 +3135,8 @@ __metadata:
yup: ^0.29.1
peerDependencies:
"@carbon/react": 1.x
"@openmrs/esm-framework": 4.x
react: ^18.2.0
"@openmrs/esm-framework": 5.x
react: 18.x
react-i18next: 11.x
rxjs: 6.x
languageName: unknown
Expand Down Expand Up @@ -6941,9 +6941,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001449, caniuse-lite@npm:^1.0.30001464":
version: 1.0.30001466
resolution: "caniuse-lite@npm:1.0.30001466"
checksum: d81d0801f72162ebb7edb222cb48702f351e1a2d6acc9f340913f5b07e28c2105d1d2de9f0633c9b89e1aa1cd14f5d9154e270bf7b61296a7209745b32bdb01c
version: 1.0.30001561
resolution: "caniuse-lite@npm:1.0.30001561"
checksum: 949829fe037e23346595614e01d362130245920503a12677f2506ce68e1240360113d6383febed41e8aa38cd0f5fd9c69c21b0af65a71c0246d560db489f1373
languageName: node
linkType: hard

Expand Down

0 comments on commit 62d521c

Please sign in to comment.