Create initial App/Search tests and related data

This commit is contained in:
2020-07-30 17:36:22 +02:00
parent 6af8d5db92
commit 5810948275
5 changed files with 529 additions and 15 deletions
+10 -7
View File
@@ -1,15 +1,18 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { render, cleanup } from '@testing-library/react';
import App from '../components/App';
describe('App', () => {
test('renders App component', () => {
render(<App />);
afterEach(cleanup);
it('displays App component', () => {
const { getByText, getByRole } = render(<App />);
// screen.debug();
expect(screen.getByText('Spoti Search')).toBeInTheDocument();
expect(screen.getByRole('textbox')).toBeInTheDocument();
expect(screen.getByPlaceholderText('Type an artist name')).toBeInTheDocument();
const title = getByText('Spoti Search');
const input = getByRole('searchbox', { name: 'Search by artist name' });
expect(title).toBeInTheDocument();
expect(input).toBeInTheDocument();
});
});