This commit is contained in:
Maciek Głowacki
2021-01-05 19:23:44 +01:00
parent 72782880c0
commit b8ef87fc83
8 changed files with 370 additions and 15257 deletions

View File

@ -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';

View 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();
});

View 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();
// });
});

View 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();
// });