jest setup, cypress type conflict fix

This commit is contained in:
ericv105
2023-01-06 01:07:27 -05:00
parent 9ce4348263
commit bf2a5e4a46
9 changed files with 10751 additions and 2 deletions
-13
View File
@@ -1,13 +0,0 @@
import React from "react";
import { Container } from "./Container";
describe("<Container />", () => {
it("renders", () => {
// see: https://on.cypress.io/mounting-react
const className = "my-class";
const text = "test_container";
cy.mount(<Container className={className}>{text}</Container>);
cy.get(`div.${className}`).should("have.class", className).should("be.visible").should("contain", text);
});
});
@@ -0,0 +1,23 @@
import { render, screen } from "@testing-library/react";
import React from "react";
import { OptionProps, TaskOption } from "./TaskOption";
describe("TaskOption component", () => {
const testProps: OptionProps = {
alt: "Task Title",
img: "/imgPath",
title: "Task Title",
link: "/create/summarize_story",
};
beforeEach(() => {
render(<TaskOption {...testProps} />);
});
it("should render Task Option component", () => {
expect(screen.getByRole("heading")).toHaveTextContent(testProps.title);
expect(screen.getByRole("link")).toHaveAttribute("href", testProps.link);
expect(screen.queryByText("hi")).toBeNull();
});
});