Skip to content

Commit

Permalink
move obs list to the mocks folder
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcliff committed Jul 10, 2024
1 parent 94fd206 commit 6ca14dd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
37 changes: 37 additions & 0 deletions __mocks__/forms/rfe-forms/obs-list-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export const obsList = [
{
concept: '7e43b05b-b6d8-4eb5-8f37-0b14f5347368',
obsDatetime: '2023-07-01',
obsGroup: null,
groupMembers: [
{
concept: '4c43b05b-b6d8-4eb5-8f37-0b14f5347548',
obsDatetime: '2023-07-02',
obsGroup: null,
groupMembers: [],
comment: '',
location: null,
order: null,
encounter: null,
voided: false,
value: null,
formFieldPath: '',
formFieldNamespace: '',
status: '',
interpretation: '',
uuid: '',
},
],
comment: '',
location: null,
order: null,
encounter: null,
voided: false,
value: null,
formFieldPath: '',
formFieldNamespace: '',
status: '',
interpretation: '',
uuid: '',
},
];
39 changes: 1 addition & 38 deletions src/utils/common-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { flattenObsList, hasRendering, clearSubmission, gracefullySetSubmission, hasSubmission } from './common-utils';
import { isEmpty } from '../validators/form-validator';
import { type FormField, type OpenmrsObs } from '../types';
import { obsList } from '__mocks__/forms/rfe-forms/obs-list-data';

jest.mock('@openmrs/esm-framework', () => ({
formatDate: jest.fn(),
Expand All @@ -14,44 +15,6 @@ jest.mock('../validators/form-validator', () => ({
describe('utils functions', () => {
describe('flattenObsList', () => {
it('should flatten a nested obs list', () => {
const obsList: OpenmrsObs[] = [
{
concept: '7e43b05b-b6d8-4eb5-8f37-0b14f5347368',
obsDatetime: '2023-07-01',
obsGroup: null,
groupMembers: [
{
concept: '4c43b05b-b6d8-4eb5-8f37-0b14f5347548',
obsDatetime: '2023-07-02',
obsGroup: null,
groupMembers: [],
comment: '',
location: null,
order: null,
encounter: null,
voided: false,
value: null,
formFieldPath: '',
formFieldNamespace: '',
status: '',
interpretation: '',
uuid: '',
},
],
comment: '',
location: null,
order: null,
encounter: null,
voided: false,
value: null,
formFieldPath: '',
formFieldNamespace: '',
status: '',
interpretation: '',
uuid: '',
},
];

const result = flattenObsList(obsList);
expect(result).toHaveLength(2);
});
Expand Down

0 comments on commit 6ca14dd

Please sign in to comment.