Skip to content

Instantly share code, notes, and snippets.

View armoredelephant's full-sized avatar
:octocat:
Working

Keith Alleman armoredelephant

:octocat:
Working
  • eviCore Healthcare
  • Mesa, AZ
View GitHub Profile
@armoredelephant
armoredelephant / ContactForm.test.tsx
Last active July 25, 2020 21:54
ContactForm.test.tsx
import { render, fireEvent, screen } from "@testing-library/react";
import ContactForm from "../ContactForm";
describe("<ContactForm />", () => {
beforeEach(() => {
render(<ContactForm />);
});
test("should display required errors when fields are invalid", async () => {
fireEvent.submit(screen.getByRole("button"), {
import { render, fireEvent, screen } from "@testing-library/react";
import ContactForm from "../ContactForm";
describe("<ContactForm />", () => {
beforeEach(() => {
render(<ContactForm />);
});
test("should display required errors when fields are invalid", async () => {
fireEvent.submit(screen.getByRole("button"), {
@armoredelephant
armoredelephant / ContactForm.tsx
Last active July 25, 2020 21:55
ContactForm.tsx
import React, { useEffect, useState } from "react";
import { useForm, SubmitHandler } from "react-hook-form";
import "isomorphic-unfetch";
type InputValues = {
name: string;
email: string;
message: string;
};
import React, { useEffect, useState } from "react";
import { useForm, SubmitHandler } from "react-hook-form";
import "isomorphic-unfetch";
interface InputValues {
name: string;
email: string;
message: string;
}