mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-08-14 02:27:35 -07:00
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:
parent
186cacee47
commit
8931a780aa
7 changed files with 41 additions and 44 deletions
30
frontend/__tests__/unit/components/NetworkHeader.test.jsx
Normal file
30
frontend/__tests__/unit/components/NetworkHeader.test.jsx
Normal 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();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue