Skip to content

Commit

Permalink
add coderabbit suggested test
Browse files Browse the repository at this point in the history
  • Loading branch information
hetunandu committed Oct 25, 2024
1 parent ba3b95c commit 86ec8d3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/client/src/IDE/Components/EditableName/EditableName.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,18 @@ describe("EditableName", () => {
expect(exitEditing).toHaveBeenCalled();
expect(onNameSave).not.toHaveBeenCalledWith(invalidTitle);
});

test("prevents saving empty name", () => {
const { getByRole, onNameSave } = setup({ isEditing: true });
const input = getByRole("textbox");

fireEvent.change(input, { target: { value: "" } });
fireEvent.keyUp(input, KEY_CONFIG.ENTER);

expect(onNameSave).not.toHaveBeenCalledWith("");
expect(getByRole("tooltip")).toHaveTextContent(
"Please enter a valid name",
);
});
});
});

0 comments on commit 86ec8d3

Please sign in to comment.