Skip to content

Commit

Permalink
MAT-7792: add coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmcphillips committed Dec 11, 2024
1 parent 43fcee1 commit 034f721
Showing 1 changed file with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,27 +519,45 @@ describe("CQL Function Builder Tests", () => {
});
expect(argumentNameInput.value).toBe("Test");

// dataType
const dataTypeDropdown = await screen.findByTestId(
"arg-type-selector-input"
);
fireEvent.change(dataTypeDropdown, {
target: { value: "Other" },
});

// we now need to populate other textfield
const otherNameInput = (await screen.findByTestId(
"other-type-input"
)) as HTMLInputElement;
expect(otherNameInput).toBeInTheDocument();
expect(otherNameInput.value).toBe("");
fireEvent.change(otherNameInput, {

// switch to blank other
fireEvent.change(dataTypeDropdown, {
target: { value: "Integer" },
});
await waitFor(() => {
expect(screen.queryByTestId("other-type-input")).not.toBeInTheDocument();
});

// select other again
fireEvent.change(dataTypeDropdown, {
target: { value: "Other" },
});
expect(otherNameInput.value).toBe("Other");
// other input appears
await waitFor(() => {
expect(screen.queryByTestId("other-type-input")).toBeInTheDocument();
});

// finda nd fill out other
const other = (await screen.findByTestId(
"other-type-input"
)) as HTMLInputElement;
fireEvent.change(other, {
target: { value: "test" },
});
await waitFor(() => {
const addButton = screen.getByTestId("function-argument-add-btn");
expect(addButton).toBeInTheDocument();
expect(addButton).toBeEnabled();
fireEvent.click(addButton);
});
Expand All @@ -563,7 +581,7 @@ describe("CQL Function Builder Tests", () => {
functionsArguments: [
expect.objectContaining({
argumentName: "Test",
dataType: "Other",
dataType: "test",
}),
],
})
Expand Down

0 comments on commit 034f721

Please sign in to comment.