mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-07 05:21:40 -07:00
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.
30 lines
914 B
JavaScript
30 lines
914 B
JavaScript
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();
|
|
});
|
|
});
|