This commit is contained in:
Philippe Torrel
2026-10-29 15:15:34 +01:00
parent f65a30752f
commit e955f3fc4f
2 changed files with 41 additions and 1 deletions
@@ -1,2 +1,21 @@
import { render, screen } from '@testing-library/react';
import ExampleComponent from '../ExampleComponent';
// import nicht notwendig ( Findet automatisch durch globale Setting statt)
import { test, it, expect } from 'vitest';
// Test case
test('Component renders correctly and contains text "Hello World"');
// it('should render correctly and contains text "Hello World"', () => {})
test('Component renders correctly and contains text "Hello World"', () => {
// AAA - Arrange, Act, Assert
// Arrange
render(<ExampleComponent />);
const element = screen.getByText(/Hello World/i);
// Act - Assert
expect(element).toBeInTheDocument();
});
// console.log(document.querySelector('p').textContent.includes('Hello World')); // => true
@@ -0,0 +1,21 @@
import { render, screen } from '@testing-library/react';
import ExampleComponent from '../components/ExampleComponent';
// import nicht notwendig ( Findet automatisch durch globale Setting statt)
import { test, it, expect } from 'vitest';
// Test case
// it('should render correctly and contains text "Hello World"', () => {})
test('Component renders correctly and contains text "Hello World"', () => {
// AAA - Arrange, Act, Assert
// Arrange
render(<ExampleComponent />);
const element = screen.getByText(/Hello World/i);
// Act - Assert
expect(element).toBeInTheDocument();
});
// console.log(document.querySelector('p').textContent.includes('Hello World')); // => true