test: reorganize folder structure and files

The specific test files used for snapshots only have been integrated in
each component's test file so that all tests, including the snapshot are
located in a single test file.

Also as more tests were added, it seems like a better idea to have test
data in a separate file on its own rather than import test data from
another test file.

FInally, with all these changes, Jest wanted to have snapshots taken
again thus why the snapshot files were updated too.
This commit is contained in:
David Laganiere 2023-01-15 10:39:35 -05:00
commit 8931a780aa
No known key found for this signature in database
GPG key ID: 18C4B80581C28747
7 changed files with 41 additions and 44 deletions

View file

@ -0,0 +1,30 @@
import { render, screen } from "@testing-library/react";
import NetworkHeader from "components/NetworkHeader";
import { testNetwork } from "../../data/network";
describe("NetworkHeader", () => {
it("renders NetworkHeader unchanged", () => {
const { container } = render(<NetworkHeader network={testNetwork} />);
expect(container).toMatchSnapshot();
});
test("renders NetworkHeader with a test network", () => {
render(<NetworkHeader network={testNetwork} />);
const networkId = screen.getByRole("heading", {
name: "0d303702cd0f1fc6",
level: 5,
});
const networkName = screen.getByRole("heading", {
name: "new-net-11166",
level: 6,
});
const networkDescription = screen.getByText(/Test Network/);
expect(networkId).toBeInTheDocument();
expect(networkName).toBeInTheDocument();
expect(networkDescription).toBeInTheDocument();
});
});