Skip to content
Snippets Groups Projects
Verified Commit a72b02b6 authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Test setup

parent c7a5ddd2
No related branches found
No related tags found
2 merge requests!11Basic implementation of login page,!8Test setup
Pipeline #11454 failed
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
import { App } from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
describe('<App />', () => {
it('renders without crashing', () => {
const wrapper = render(<App />);
expect(wrapper.queryByTestId('App')).toBeTruthy();
});
});
import React from 'react';
import { Form } from './components/LoginForm/index';
import { Form } from './components/LoginForm/LoginForm';
export const App: React.FC = () => (
<div className="App">
......
import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import { LoginForm } from './LoginForm';
describe('Email input', () => {
it('Should handle email insertion and validation');
it('renders button', () => {
const wrapper = render(<LoginForm />);
console.log(wrapper.queryByTestId('LoginButton'));
expect(wrapper.queryByTestId('LoginButton')).toBeTruthy();
});
});
......@@ -4,13 +4,6 @@ import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import { isEmailValid } from './emailValidator';
/**
* TODO
* Add enviroment variable for host
* Connect to api
* Add cookie session fetch
*/
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
......@@ -42,15 +35,6 @@ export const Form: React.FC = () => {
};
const [formValues, setFormValues] = useState<formData>(defaultValues);
const requestOptions = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: formValues.email,
password: formValues.password,
}),
};
const handleSubmit = (event: React.FormEvent): void => {
event.preventDefault();
const errors: Array<string> = [];
......@@ -59,10 +43,6 @@ export const Form: React.FC = () => {
console.log('Email address not valid');
} else {
console.log(formValues);
fetch(
'https://jsonplaceholder.typicode.com/posts',
requestOptions,
).then((response) => response.json());
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment