mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-21 12:20:08 +08:00
jest setup, cypress type conflict fix
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user