ch09-NotFound
Last updated
// src/components/NotFound.tsx
export default function NotFound() {
return <div>hello</div>;
}// src/components/NotFound.cy.tsx
import NotFound from "./NotFound";
import "../styles.scss";
describe("NotFound", () => {
it("should", () => {
cy.mount(<NotFound />);
cy.getByCy("not-found").should("be.visible");
cy.get("svg");
cy.get("span").contains("These aren't the bits you're looking for");
});
});// src/components/NotFound.tsx
export default function NotFound() {
return (
<div data-cy="not-found">
<svg />
<span>These aren't the bits you're looking for</span>
</div>
);
}// src/components/NotFound.tsx
import { FaExclamationTriangle } from "react-icons/fa";
export default function NotFound() {
return (
<div data-cy="not-found">
<FaExclamationTriangle />
<span>These aren't the bits you're looking for</span>
</div>
);
}import { FaExclamationTriangle } from "react-icons/fa";
export default function NotFound() {
return (
<div data-cy="not-found" className="content-container">
<div className="content-title-group not-found">
<div data-cy="exclamation">
<FaExclamationTriangle />
</div>
<span className="title">These aren't the bits you're looking for</span>
</div>
</div>
);
}// src/components/NotFound.test.tsx
import NotFound from "./NotFound";
import { render, screen } from "@testing-library/react";
import "@testing-library/jest-dom";
describe("NotFound", () => {
it("should", async () => {
render(<NotFound />);
expect(await screen.findByTestId("not-found")).toBeVisible();
expect(await screen.findByTestId("exclamation")).toBeVisible();
expect(
await screen.findByText("These aren't the bits you're looking for")
).toBeVisible();
});
});