Skip to content

Commit 1c248ff

Browse files
committed
setup: working message form input
1 parent deefd64 commit 1c248ff

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react";
2+
import { render, fireEvent } from "@testing-library/react";
3+
import { MessageForm } from "../../components/MessageForm";
4+
import { USER } from "../../config";
5+
6+
describe("MessageForm", () => {
7+
test("initiates text as empty", () => {
8+
const utils = render(<MessageForm user={USER} />);
9+
const input = utils.getByLabelText("message-form");
10+
expect(input.value).toBe("");
11+
});
12+
13+
test("updates with user typing", () => {
14+
const text = "55555";
15+
const utils = render(<MessageForm user={USER} />);
16+
const input = utils.getByLabelText("message-form");
17+
fireEvent.change(input, { target: { value: text } });
18+
expect(input.value).toBe(text);
19+
});
20+
});

0 commit comments

Comments
 (0)