Skip to content

Commit

Permalink
Update outdated testing library dependencies (#2968)
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot authored Nov 14, 2024
1 parent e4514a6 commit a63cb04
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 652 deletions.
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,16 @@
"@storybook/react": "^8.4.1",
"@storybook/react-webpack5": "^8.4.1",
"@svitejs/changesets-changelog-github-compact": "^0.1.1",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/react-hooks": "^8.0.0",
"@testing-library/react-native": "^11.0.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@types/fs-extra": "^11.0.3",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.14.149",
"@types/node": "^18.6.1",
"@types/prop-types": "^15.7.5",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@types/testing-library__jest-dom": "^5.14.5",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"autoprefixer": "^10.0.1",
"babel-jest": "29.7.0",
"babel-loader": "9.1.3",
Expand Down Expand Up @@ -102,7 +98,7 @@
"storybook": "^8.4.1",
"style-loader": "^4.0.0",
"tailwindcss": "^3.3.0",
"ts-jest": "^29.1.2",
"ts-jest": "^29.2.5",
"ts-loader": "^9.3.0",
"ts-node": "^10.9.1",
"typescript": "^4.7.3",
Expand Down
5 changes: 3 additions & 2 deletions packages/victory-core/src/victory-util/log.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* global console */
/* global console process */
/* eslint-disable no-console */

// TODO: Use "warning" npm module like React is switching to.
export function warn(message: string) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - Webpack DefinePlugin will replace process.env.NODE_ENV
if (process.env.NODE_ENV !== "production") {
if (console && console.warn) {
console.warn(message);
Expand Down
54 changes: 0 additions & 54 deletions packages/victory-native/jest-native-setup.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions packages/victory-native/jest.config.ts

This file was deleted.

19 changes: 3 additions & 16 deletions packages/victory-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,22 +324,9 @@
]
},
"jest": {
"command": "jest",
"files": [
"src/**/*.test.*",
"../../.babelrc.js",
"./jest.config.ts",
"./jest-native-setup.tsx"
],
"output": [],
"dependencies": [
"build:lib:cjs",
"../victory-vendor:build:lib:cjs",
"../victory-voronoi:build:lib:cjs"
],
"packageLocks": [
"pnpm-lock.yaml"
]
"command": "echo \"victory-native (legacy) has no tests\"",
"files": [],
"output": []
}
}
}
66 changes: 0 additions & 66 deletions packages/victory-native/src/components.test.ts

This file was deleted.

22 changes: 18 additions & 4 deletions packages/victory-tooltip/src/victory-tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,32 @@ describe("components/victory-tooltip", () => {

it("renders nothing when not active", () => {
render(<VictoryTooltip {...baseProps} active={false} />, {
wrapper: VictoryContainer,
wrapper: VictoryContainer as React.JSXElementConstructor<{
children: React.ReactNode;
}>,
});
const output = screen.queryByTestId(labelId);
expect(output).not.toBeInTheDocument();
});

it("renders the expected text", () => {
render(<VictoryTooltip {...baseProps} />, { wrapper: VictoryContainer });
render(<VictoryTooltip {...baseProps} />, {
wrapper: VictoryContainer as React.JSXElementConstructor<{
children: React.ReactNode;
}>,
});
const output = screen.getByTestId(labelId);
expect(output).toBeInTheDocument();
expect(output).toBeVisible();
expect(output).toHaveTextContent(baseProps.text);
});

it("renders a flyout and a label", () => {
render(<VictoryTooltip {...baseProps} />, { wrapper: VictoryContainer });
render(<VictoryTooltip {...baseProps} />, {
wrapper: VictoryContainer as React.JSXElementConstructor<{
children: React.ReactNode;
}>,
});
const label = screen.getByTestId(labelId);
const flyout = screen.getByTestId(flyoutId);
expect(label).toBeInTheDocument();
Expand All @@ -49,7 +59,11 @@ describe("components/victory-tooltip", () => {
const clickHandler = jest.fn();
render(
<VictoryTooltip {...baseProps} events={{ onClick: clickHandler }} />,
{ wrapper: VictoryContainer },
{
wrapper: VictoryContainer as React.JSXElementConstructor<{
children: React.ReactNode;
}>,
},
);
fireEvent.click(screen.getByTestId(flyoutId));
expect(clickHandler).toBeCalled();
Expand Down
Loading

0 comments on commit a63cb04

Please sign in to comment.