使用react-testing-library渲染快照Formik

时间:2019-08-24 09:05:22

标签: reactjs formik react-testing-library

我想用Formik渲染快照,但是我收到了null?有人可以帮忙吗

import React from "react";
import { render } from "@testing-library/react";
import Module from "./index";

describe("Dashboard - Module Profile List - Component Modal Send Invitation", () => {
  const defaultProps = {
    isOpening: true,
    onSubmit: () => {},
    onClose: () => {},
    profiles: [],
    profileIds: []
  };

  test("renders", () => {
    const { container } = render(<Module {...defaultProps} />);
    expect(container).toMatchSnapshot();
  });
});

我希望输出是快照,但是会收到

exports[`Dashboard - Module Profile List - Component Modal Send Invitation renders 1`] = `<div />`;

0 个答案:

没有答案