-
Notifications
You must be signed in to change notification settings - Fork 178
Expand file tree
/
Copy pathLogin.test.jsx
More file actions
29 lines (22 loc) · 900 Bytes
/
Login.test.jsx
File metadata and controls
29 lines (22 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from "react";
import { render } from "@testing-library/react";
import LoginPage from "./index";
describe("<LoginPage />", () => {
test("renders without crashing", async () => {
const { findAllByText } = render(<LoginPage />);
const title = await findAllByText(/Login/i);
expect(title).toBeTruthy();
})
test("renders a form with two inputs", async () => {
const { findByPlaceholderText } = render(<LoginPage />);
const inputEmail = await findByPlaceholderText(/username/i);
const inputPassword = await findByPlaceholderText(/password/i);
expect(inputEmail).toBeInTheDocument();
expect(inputPassword).toBeInTheDocument();
})
test("There is a button to submit the form", async () => {
const { container } = render(<LoginPage />);
const button = container.querySelector("button");
expect(button).toBeInTheDocument();
})
})