Skip to content

Commit

Permalink
#234 Upgrade Vitest libraries to latest version (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
nevendyulgerov authored Sep 5, 2024
1 parent 7564336 commit ea1a4c0
Show file tree
Hide file tree
Showing 10 changed files with 985 additions and 396 deletions.
11 changes: 7 additions & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"lint": "next lint",
"test": "vitest run",
"test:watch": "vitest",
"test:ui": "vitest --ui",
"test:ci": "vitest run --coverage",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui"
Expand Down Expand Up @@ -64,25 +65,27 @@
"@graphql-typed-document-node/core": "^3",
"@playwright/test": "^1.43.1",
"@sunodo/wagmi-plugin-hardhat-deploy": "^0.2",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.0",
"@types/node": "^20",
"@types/ramda": "^0.30.1",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.1.0",
"@vitest/coverage-v8": "0.34.2",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/ui": "^2.0.5",
"@wagmi/cli": "^2",
"dotenv-cli": "7.3.0",
"eslint": "^8",
"eslint-config-cartesi": "*",
"happy-dom": "^15.0.0",
"jsdom": "22.1.0",
"npm-run-all": "^4",
"postcss": "^8",
"postcss-preset-mantine": "^1.12.3",
"postcss-simple-vars": "^7",
"ts-node": "^10",
"typescript": "^5",
"vitest": "0.34.2"
"vitest": "^2.0.5"
}
}
12 changes: 6 additions & 6 deletions apps/web/test/components/connection/connectionForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("connectionForm", () => {
).toBeInTheDocument();

expect(screen.getByTestId("icon-test-inactive")).toBeInTheDocument();
expect(screen.getByText("Save")).toBeInTheDocument();
expect(screen.getByTestId("connection-save")).toBeInTheDocument();
});

it("should present a list of applications suggestions when click on address input", () => {
Expand Down Expand Up @@ -229,7 +229,7 @@ describe("connectionForm", () => {

render(<AppConnectionFormE />);

fireEvent.click(screen.getByText("Save"));
fireEvent.click(screen.getByTestId("connection-save"));

expect(
screen.getByText("Address is a required field!"),
Expand Down Expand Up @@ -277,7 +277,7 @@ describe("connectionForm", () => {
screen.getByText("This application responded with"),
).toBeInTheDocument();

fireEvent.click(screen.getByText("Save"));
fireEvent.click(screen.getByTestId("connection-save"));

expect(addConnection).toHaveBeenCalledWith(
{ address, url },
Expand Down Expand Up @@ -324,7 +324,7 @@ describe("connectionForm", () => {
screen.getByText("This application responded with"),
).toBeInTheDocument();

fireEvent.click(screen.getByText("Save"));
fireEvent.click(screen.getByTestId("connection-save"));

expect(addConnection).toHaveBeenCalledWith(
{ address, url },
Expand Down Expand Up @@ -371,7 +371,7 @@ describe("connectionForm", () => {
screen.getByText("This application responded with"),
).toBeInTheDocument();

fireEvent.click(screen.getByText("Save"));
fireEvent.click(screen.getByTestId("connection-save"));

expect(addConnection).toHaveBeenCalledTimes(0);
});
Expand Down Expand Up @@ -407,7 +407,7 @@ describe("connectionForm", () => {
target: { value: url },
});

fireEvent.click(screen.getByText("Save"));
fireEvent.click(screen.getByTestId("connection-save"));

expect(addConnection).not.toHaveBeenCalled();
expect(notificationsMock.show).toHaveBeenCalledWith({
Expand Down
13 changes: 10 additions & 3 deletions apps/web/test/components/inputs/inputDetailsView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,19 @@ describe("Input details view component", () => {
it("should try to parse the inputs payload As Text", () => {
render(<View input={inputSample} />);

fireEvent.click(screen.getByText("As Text"));
fireEvent.click(
screen.getByText("As Text").parentNode as HTMLLabelElement,
);

expect(screen.getByDisplayValue("joinGame")).toBeInTheDocument();
});

it("should try to parse the inputs payload As JSON", () => {
render(<View input={inputSample} />);

fireEvent.click(screen.getByText("As JSON"));
fireEvent.click(
screen.getByText("As JSON").parentNode as HTMLLabelElement,
);

expect(screen.getByDisplayValue("joinGame")).toBeInTheDocument();
});
Expand Down Expand Up @@ -196,7 +200,10 @@ describe("Input details view component", () => {

const reportsPanel = screen.getByTestId("panel-reports");

fireEvent.click(getByText(reportsPanel, "As Text"));
fireEvent.click(
getByText(reportsPanel, "As Text")
.parentNode as HTMLLabelElement,
);

expect(screen.getByDisplayValue("Qh4+")).toBeVisible();
});
Expand Down
Loading

0 comments on commit ea1a4c0

Please sign in to comment.