Reactjs gatsbyJS中graphQL查询与页面组件的集成测试

Reactjs gatsbyJS中graphQL查询与页面组件的集成测试,reactjs,testing,graphql,integration-testing,gatsby,Reactjs,Testing,Graphql,Integration Testing,Gatsby,我想对我的页面查询+页面组件进行集成测试: import React from "react"; import { graphql } from "gatsby"; const NotFound = ({ data }) => { const { title, text } = data.allFile.edges[0].node.childDataJson; return ( <React.Fragment> <h1>{title}

我想对我的页面查询+页面组件进行集成测试:

import React from "react";
import { graphql } from "gatsby";

const NotFound = ({ data }) => {
  const { title, text } = data.allFile.edges[0].node.childDataJson;

  return (
    <React.Fragment>
      <h1>{title}</h1>
      <p>{text}</p>
    </React.Fragment>
  );
};

export const query = graphql`
  query {
    allFile(filter: { name: { eq: "404" } }) {
      edges {
        node {
          childDataJson {
            title
            text
          }
        }
      }
    }
  }
`;

export default NotFound;

这涵盖了盖茨比的内部运作,你可能在这里得不到答案。您应该在github上打开一个问题,并直接询问维护人员。这涵盖了盖茨比的内部工作,您可能无法在这里得到答案。您应该在github上打开一个问题,并直接询问维护人员。
describe("404 page", () => {
  it("Contains a title", () => {
    const { getByText } = render(<NotFound />);
    expect(getByText("Not found")).toBeInTheDocument();
  });
});
const React = require("react");
const gatsby = jest.requireActual("gatsby");

module.exports = {
  ...gatsby,
  graphql: jest.fn(),
};