tests
This commit is contained in:
parent
78e63ce587
commit
afd809a9ec
20
src/components/__tests__/Admin.test.jsx
Normal file
20
src/components/__tests__/Admin.test.jsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { cleanup, fireEvent, screen } from '@testing-library/react';
|
||||||
|
import '@testing-library/jest-dom/extend-expect';
|
||||||
|
import { customRender } from '../../customRender';
|
||||||
|
import { Admin } from '../Admin';
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
delete window.location;
|
||||||
|
window.location = { replace: jest.fn() };
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
window.location = location;
|
||||||
|
});
|
||||||
|
|
||||||
|
test('renders component', async () => {
|
||||||
|
const addItem = jest.fn();
|
||||||
|
customRender(<Admin />);
|
||||||
|
expect(screen.getByText(/Pokaż plan/i)).toBeInTheDocument();
|
||||||
|
});
|
@ -16,5 +16,5 @@ afterAll(() => {
|
|||||||
test('renders component', async () => {
|
test('renders component', async () => {
|
||||||
const addItem = jest.fn();
|
const addItem = jest.fn();
|
||||||
customRender(<Scheduler/>);
|
customRender(<Scheduler/>);
|
||||||
expect(screen.getByText(/chuj/i)).toBeInTheDocument();
|
expect(screen.getByText(/Poniedziałek/i)).toBeInTheDocument();
|
||||||
});
|
});
|
@ -20,19 +20,22 @@ test('renders component', async () => {
|
|||||||
|
|
||||||
test('input should display default placeholder for student', async () => {
|
test('input should display default placeholder for student', async () => {
|
||||||
const { getByPlaceholderText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
const { getByPlaceholderText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
||||||
const input = getByPlaceholderText('Wyszukaj przedmioty...');
|
setTimeout(()=>{const input = getByPlaceholderText('Wyszukaj przedmioty...');
|
||||||
|
expect(input).toBeInTheDocument();},2000);
|
||||||
// fireEvent.change(input, { target: { value: '122' } });
|
// fireEvent.change(input, { target: { value: '122' } });
|
||||||
// console.log(debug());
|
// console.log(debug());
|
||||||
// const textNode = await waitForElement(() => getByText('asdasdsa'));
|
// const textNode = await waitForElement(() => getByText('asdasdsa'));
|
||||||
// console.log(debug());
|
// console.log(debug());
|
||||||
expect(input).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('input should display changed value', async () => {
|
test('input should display changed value', async () => {
|
||||||
const { getByPlaceholderText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
const { getByPlaceholderText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
||||||
const input = getByPlaceholderText('Wyszukaj przedmioty...');
|
setTimeout(()=>{ const input = getByPlaceholderText('Wyszukaj przedmioty...');
|
||||||
fireEvent.change(input, { target: { value: '122' } });
|
fireEvent.change(input, { target: { value: '122' } });expect(input.value).toBe("122");},2000);
|
||||||
|
|
||||||
|
|
||||||
// console.log(debug());
|
// console.log(debug());
|
||||||
// console.log(debug());
|
// console.log(debug());
|
||||||
expect(input.value).toBe("122");
|
|
||||||
});
|
});
|
||||||
|
@ -222,6 +222,8 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
}, 600);
|
}, 600);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
console.log("123,",userID,courses,basket)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<coursesContext.Provider
|
<coursesContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
Loading…
Reference in New Issue
Block a user