Skip to content

Instantly share code, notes, and snippets.

View albertBarsegyan's full-sized avatar
🌎
Do your best

Albert albertBarsegyan

🌎
Do your best
View GitHub Profile
@albertBarsegyan
albertBarsegyan / example.test.js
Created September 2, 2021 14:18
Form failure test
it('Failure test', async () => {
const handleSubmit = jest.fn();
render(<CompanyForm onSubmit={handleSubmit} />);
const submitButton = screen.getByTestId('companyFormSubmitButton');
const nameError = screen.getByTestId('nameError');
const emailError = screen.queryByTestId('emailError');
const phoneNumberError = screen.queryByTestId('phoneNumberError');
const agreementError = screen.queryByTestId('agreementError');
@albertBarsegyan
albertBarsegyan / example.test.js
Created September 2, 2021 13:52
example.test.js imports
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import formTestConstants from '../../constants/formTest.constants';
import { CompanyForm } from '../../components/forms/CompanyForm/CompanyForm';
@albertBarsegyan
albertBarsegyan / example.test.js
Last active September 2, 2021 14:00
Form testing
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import formTestConstants from '../../constants/formTest.constants';
import { CompanyForm } from '../../components/forms/CompanyForm/CompanyForm';
// testing if company form is working
describe('CompanyForm tests 🙂', () => {
it('Success test', async () => {