Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue on page /react/snapshot_testing.html [7. Use Snapshot Testing] #590

Open
avimishra18 opened this issue Mar 12, 2022 · 1 comment
Open

Comments

@avimishra18
Copy link
Contributor

Issue

ESLint Error: eslint(testing-library/render-result-naming-convention) in the code snippet of the topic 7. Use Snapshot Testing

Link to Community Discussion. Assigning this issue to myself.

Incorrect Code Snippet

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

import FaqItem from "./FaqItem";

describe("FaqItem", () => {
  it("renders a FAQ item", () => {
    const component = render(
      <FaqItem
        question="What is the answer to life the universe and everything?"
        answer="42"
      />
    );
    expect(component).toMatchSnapshot();
  });
});

Corrected Code Snippet

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

import FaqItem from "./FaqItem";

describe("FaqItem", () => {
	it("renders a FAQ item", () => {
		const view = render(
			<FaqItem
				question="What is the answer to life the universe and everything?"
				answer="42"
			/>
		);
		expect(view).toMatchSnapshot();
	});
});
@stevepiercy
Copy link
Contributor

Please submit a PR for this, but use spaces instead of tabs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants