Skip to content

Commit

Permalink
tests: unignore and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vacekj committed Jan 25, 2024
1 parent 4b5c74f commit 34f9240
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 467 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe("<ErrorModal />", () => {
expect(setIsOpenFn).toBeCalledWith(false);
});

it.skip("should close the modal if close on background click is enabled and background is clicked", () => {
it("should close the modal if close on background click is enabled and background is clicked", () => {
const doneFn = vi.fn();
const setIsOpenFn = vi.fn();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { faker } from "@faker-js/faker";
import { fireEvent, screen, waitFor } from "@testing-library/react";
import { screen, waitFor } from "@testing-library/react";
import {
makeRoundOverviewData,
mockBalance,
mockNetwork,
mockSigner,
renderWithContext,
} from "../../../test-utils";
import { __deprecated_RoundMetadata } from "../../api/round";
import { __deprecated_RoundOverview } from "../../api/rounds";
import LandingPage from "../LandingPage";
import { vi } from "vitest";
import { DataLayer } from "data-layer";
Expand Down Expand Up @@ -115,52 +113,4 @@ describe("LandingPage", () => {
});
});
});

it.skip("filters active rounds based on search query", async () => {
const roundMetadata: __deprecated_RoundMetadata = {
name: "gitcoin",
roundType: "private",
eligibility: {
description: faker.lorem.sentence(),
requirements: [],
},
programContractAddress: faker.finance.ethereumAddress(),
};

const activeRounds: __deprecated_RoundOverview[] = [
makeRoundOverviewData(),
makeRoundOverviewData(),
makeRoundOverviewData({ roundMetadata }),
makeRoundOverviewData({
roundMetadata: {
...roundMetadata,
name: "gitcoin pro",
},
}),
];

renderWithContext(<LandingPage />);

await waitFor(async () => {
// Make sure all active rounds are displayed initially
activeRounds.forEach((round) => {
expect(
screen.getByText(round.roundMetadata?.name ?? "")
).toBeInTheDocument();
});
});

const searchInput = screen.getByPlaceholderText("Search...");
const roundCards = screen.getAllByTestId("round-card");
expect(roundCards.length).toEqual(activeRounds.length);

const searchQuery = "gitcoin";
fireEvent.change(searchInput, { target: { value: searchQuery } });

await waitFor(() => {
const filteredRoundCards = screen.getAllByTestId("round-name");
expect(filteredRoundCards.length).toEqual(2);
expect(filteredRoundCards[0].textContent).toEqual(searchQuery);
});
});
});
Loading

0 comments on commit 34f9240

Please sign in to comment.