-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(test) O3-2216: Add tests for id-field.component.tsx
#748
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @ayush-AI. I requested some minor changes.
Btw, there's a formatting pattern called Arrange-Act-Assert, which is used to improve the readability of tests. You can follow it when arranging the steps of the tests (if it suits our test cases).
packages/esm-patient-registration-app/src/patient-registration/field/id/id-field.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-registration-app/src/patient-registration/field/id/id-field.test.tsx
Outdated
Show resolved
Hide resolved
expect(screen.getByText('Configure')).toBeInTheDocument(); | ||
expect(screen.getByText('Configure')).toBeEnabled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is related to a Button, we can use getByRole('button', { name: 'Configure' }). We need to make sure that we are querying the correct element.
(Use getByRole() whenever it is possible.)
packages/esm-patient-registration-app/src/patient-registration/field/id/id-field.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-registration-app/src/patient-registration/field/id/id-field.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-registration-app/src/patient-registration/field/id/id-field.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-registration-app/src/patient-registration/field/id/id-field.test.tsx
Outdated
Show resolved
Hide resolved
...es/esm-patient-registration-app/src/patient-registration/field/__mocks__/identifiers.mock.ts
Show resolved
Hide resolved
packages/esm-patient-registration-app/src/patient-registration/field/id/id-field.test.tsx
Show resolved
Hide resolved
...m-patient-registration-app/src/patient-registration/field/__mocks__/identifier-types.mock.ts
Outdated
Show resolved
Hide resolved
initialFormValues: { identifiers: { openmrsID } }, | ||
setInitialFormValues: jest.fn(), | ||
values: { | ||
identifiers: { openmrsID }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identifiers: { openmrsID }, | |
identifiers: { mockedIdentifierTypes[0] }, |
I meant some thing like this. Check my comment on identifier-types.mock.ts
as well. If it is not working, let's keep this as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated it as per your suggestions @Piumal1999. Please check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requested change is not added. Could you please recheck? @ayush-AI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not working like the way you are suggesting. The test is failing because of syntax error
...es/esm-patient-registration-app/src/patient-registration/field/__mocks__/identifiers.mock.ts
Show resolved
Hide resolved
@ayush-AI could you please check @Piumal1999 's comments? |
I checked it and it is not working as piumal suggested to try. That is why I have to keep that file. cc:/ @Piumal1999 |
Can we move this along @ayush-AI @Piumal1999? |
yup we can @denniskigen. If other things seems okay to you. |
b3c5172
to
20568fa
Compare
Requirements
Summary
In this PR i have added test for id-field component.
Screenshots
Related Issue
https://issues.openmrs.org/browse/O3-2216
Other
None.