Skip to content

Commit d903639

Browse files
committed
Replace non-canonical tests with canonical component-level test
Previous tests were not canonical and did not test the component-level behavior. Rather, they test implementation details. They also used non-canonical imports instead of Jest globals and are not colocated properly to the code they were testing.
1 parent 014df6b commit d903639

File tree

3 files changed

+34
-107
lines changed

3 files changed

+34
-107
lines changed

packages/apps/esm-implementer-tools-app/src/configuration/configuration.test.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,38 @@ describe('Configuration', () => {
361361
// expect(mockSetTemporaryConfigValue).toHaveBeenCalledWith(["@openmrs/luigi", "favoriteNumbers"], [5, 11, 13]);
362362
}
363363
});
364+
365+
it('handles hovering over config tree items without crashing', async () => {
366+
const user = userEvent.setup();
367+
368+
implementerToolsConfigStore.setState({
369+
config: {
370+
'@openmrs/mario': {
371+
hasHat: mockImplToolsConfig['@openmrs/mario'].hasHat,
372+
weapons: {
373+
gloves: {
374+
_type: Type.Number,
375+
_default: 0,
376+
_value: 2,
377+
_source: 'provided',
378+
},
379+
},
380+
},
381+
},
382+
});
383+
384+
renderConfiguration();
385+
386+
// Find and hover over a leaf node (hasHat)
387+
const hasHatElement = await screen.findByText('hasHat');
388+
await user.hover(hasHatElement);
389+
390+
// Find and hover over a branch node (weapons) - this should not crash
391+
const weaponsElement = await screen.findByText('weapons');
392+
await user.hover(weaponsElement);
393+
394+
// Both elements should still be in the document (no crash occurred)
395+
expect(hasHatElement).toBeInTheDocument();
396+
expect(weaponsElement).toBeInTheDocument();
397+
});
364398
});

packages/apps/esm-implementer-tools-app/src/configuration/interactive-editor/__tests__/config-subtree-type-check.test.tsx

Lines changed: 0 additions & 41 deletions
This file was deleted.

packages/apps/esm-implementer-tools-app/src/configuration/interactive-editor/__tests__/editable-value-unset.test.tsx

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)