Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent deefd64 commit 1c248ffCopy full SHA for 1c248ff
src/tests/components/MessageForm.test.js
@@ -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
16
17
+ fireEvent.change(input, { target: { value: text } });
18
+ expect(input.value).toBe(text);
19
20
+});
0 commit comments