Complete the code to import the snapshot testing function from React Native Testing Library.
import { [1] } from '@testing-library/react-native';
The render function is used to render the component for snapshot testing.
Complete the code to create a snapshot test for a component named MyButton.
test('renders correctly', () => { const tree = render(<MyButton />).[1](); expect(tree).toMatchSnapshot(); });
The toJSON method converts the rendered component to a JSON format suitable for snapshot comparison.
Fix the error in the snapshot test by completing the missing matcher.
expect(tree).[1]();The toMatchSnapshot matcher compares the rendered output to the saved snapshot.
Fill both blanks to create a snapshot test that renders MyComponent and converts it to JSON.
const tree = [1](<MyComponent />).[2]();
You first render the component with render, then convert it to JSON with toJSON for snapshot testing.
Fill all three blanks to write a snapshot test that renders Button, converts it to JSON, and expects it to match the snapshot.
test('Button snapshot', () => { const tree = [1](<Button />).[2](); expect(tree).[3](); });
This test renders the Button component, converts it to JSON, and checks if it matches the saved snapshot.