tests
This commit is contained in:
@ -3,8 +3,6 @@ import { ReactComponent as Close } from '../assets/close.svg';
|
||||
import ProfileIcon from '../assets/account.svg';
|
||||
import { Profile } from './Profile';
|
||||
import { Dropdown } from './Dropdown';
|
||||
import PolishIcon from '../assets/poland.svg';
|
||||
import EnglishIcon from '../assets/united-kingdom.svg';
|
||||
import styled from 'styled-components/macro';
|
||||
import ClickAwayListener from 'react-click-away-listener';
|
||||
import { SelectMenu } from './SelectMenu';
|
||||
|
21
src/components/__tests__/App.test.jsx
Normal file
21
src/components/__tests__/App.test.jsx
Normal file
@ -0,0 +1,21 @@
|
||||
import React from 'react';
|
||||
import { cleanup, fireEvent, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
import { customRender } from '../../customRender';
|
||||
import { App } from '../App';
|
||||
|
||||
beforeAll(() => {
|
||||
delete window.location;
|
||||
window.location = { replace: jest.fn() };
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
window.location = location;
|
||||
});
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
test('renders application', async () => {
|
||||
customRender(<App />);
|
||||
expect(screen.getByText(/plan na plan/i)).toBeInTheDocument();
|
||||
});
|
29
src/components/__tests__/Rightbar.test.jsx
Normal file
29
src/components/__tests__/Rightbar.test.jsx
Normal file
@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import { cleanup, fireEvent, waitForElement, screen, waitFor } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
import { customRender } from '../../customRender';
|
||||
import Topbar from '../Topbar';
|
||||
import { Rightbar } from '../Rightbar';
|
||||
|
||||
beforeAll(() => {
|
||||
delete window.location;
|
||||
window.location = { replace: jest.fn() };
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
window.location = location;
|
||||
});
|
||||
|
||||
test('renders component', async () => {
|
||||
const addItem = jest.fn();
|
||||
customRender(<Rightbar handrleTransfer={() => {}} />);
|
||||
expect(screen.getByText(/zapisz/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('component handles button click', async () => {
|
||||
customRender(<Rightbar />);
|
||||
fireEvent.click(screen.getByText(/zapisz/i));
|
||||
// await waitFor(() => {
|
||||
// expect(screen.getByText(/zapisywanie planu nie powiodło się/i)).toBeInTheDocument();
|
||||
// });
|
||||
});
|
29
src/components/__tests__/Topbar.test.jsx
Normal file
29
src/components/__tests__/Topbar.test.jsx
Normal file
@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import { cleanup, fireEvent, waitForElement, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
import { customRender } from '../../customRender';
|
||||
import Topbar from '../Topbar';
|
||||
|
||||
beforeAll(() => {
|
||||
delete window.location;
|
||||
window.location = { replace: jest.fn() };
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
window.location = location;
|
||||
});
|
||||
|
||||
test('renders component', async () => {
|
||||
customRender(<Topbar handrleTransfer={() => {}} />);
|
||||
expect(screen.getByText(/plan na plan/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// test('calculate results after user types value', async () => {
|
||||
// const { getByLabelText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
||||
// const input = getByLabelText('xd');
|
||||
// fireEvent.change(input, { target: { value: '122' } });
|
||||
// console.log(debug());
|
||||
// const textNode = await waitForElement(() => getByText('asdasdsa'));
|
||||
// console.log(debug());
|
||||
// expect(textNode).toBeInTheDocument();
|
||||
// });
|
Reference in New Issue
Block a user