Created
March 12, 2024 16:13
-
-
Save Pretorian/33fadd1847588332491b8c0d86c86f23 to your computer and use it in GitHub Desktop.
App renders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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