Skip to content

Instantly share code, notes, and snippets.

@Pretorian
Created March 12, 2024 16:13
Show Gist options
  • Save Pretorian/33fadd1847588332491b8c0d86c86f23 to your computer and use it in GitHub Desktop.
Save Pretorian/33fadd1847588332491b8c0d86c86f23 to your computer and use it in GitHub Desktop.
App renders
// App.test.js
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
describe('App', () => {
test('renders the app component', () => {
render(<App />);
// Check if the heading is rendered
const headingElement = screen.getByText('Welcome to My App');
expect(headingElement).toBeInTheDocument();
// Check if the paragraph is rendered
const paragraphElement = screen.getByText('This is a sample application.');
expect(paragraphElement).toBeInTheDocument();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment