Skip to content

Commit

Permalink
Fixed code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
johanna-skylight committed Sep 27, 2023
1 parent 18db623 commit 0115469
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions frontend/src/app/patients/AddPatientTestUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,29 @@ export const fillOutForm = async (
) => {
const inputElements = Object.entries(inputs);

for (let i = 0; i < inputElements.length; i++) {
for (const [label, value] of inputElements) {
fireEvent.change(
screen.getByLabelText(inputElements[i][0], {
screen.getByLabelText(label, {
exact: false,
}),
{ target: { value: inputElements[i][1] } }
{ target: { value } }
);
}

const dropDownElements = Object.entries(dropdowns);

for (let i = 0; i < dropDownElements.length; i++) {
for (const [label, value] of dropDownElements) {
fireEvent.change(
screen.getByLabelText(dropDownElements[i][0], {
screen.getByLabelText(label, {
exact: false,
}),
{ target: { value: dropDownElements[i][1] } }
{ target: { value } }
);
}

const inputGroupsElements = Object.entries(inputGroups);

for (let i = 0; i < inputGroupsElements.length; i++) {
const [legend, { label, exact }] = inputGroupsElements[i];
for (const [legend, { label, exact }] of inputGroupsElements) {
const fieldset = screen
.getByText(legend, {
exact: true,
Expand All @@ -59,7 +58,7 @@ export const fillOutForm = async (
}
fireEvent.click(
within(fieldset).getByLabelText(label, {
exact: exact || false,
exact: exact ?? false,
})
);
}
Expand Down

0 comments on commit 0115469

Please sign in to comment.