Skip to content

Commit

Permalink
fix: apply and simplify jest lint rules (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojeytonwilliams authored Apr 10, 2024
1 parent adc6a2c commit 3f53bf3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
12 changes: 2 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,8 @@
},
"overrides": [
{
"files": ["**/*.test.js"],
"extends": ["plugin:jest/recommended"],
"plugins": ["jest"],
"rules": {
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error"
}
"files": ["**/*.test.*"],
"extends": ["plugin:jest/recommended", "plugin:jest/style"]
}
]
}
2 changes: 1 addition & 1 deletion src/drop-down/drop-down.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("<DropDownButton>", () => {
const item = within(unorderedList).getAllByRole("menuitem");
expect(unorderedList).toBeInTheDocument();
expect(dropdownTrigger).toBeInTheDocument();
expect(item.length).toBe(3);
expect(item).toHaveLength(3);
});

it("should render button with direction to up", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/form-group/form-group.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ describe("<FormGroup>", () => {
);

const element = screen.getByTestId("test-id");
expect(element.childNodes.length).toBe(sameNumberOfChildren);
expect(element.childNodes).toHaveLength(sameNumberOfChildren);

const formGroupChildren = screen.getAllByTitle("Child");
expect(formGroupChildren.length).toBe(sameNumberOfChildren);
expect(formGroupChildren).toHaveLength(sameNumberOfChildren);
element.childNodes.forEach((child, index) => {
expect(child).toBe(formGroupChildren[index]);
});
Expand Down

0 comments on commit 3f53bf3

Please sign in to comment.