diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-04-04 16:44:47 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-04-04 17:34:57 +0900 |
commit | 2b1079525b86dad45df11e6ad29a89989a6416ab (patch) | |
tree | 6bc29a0bce0adc66b6b82d01ecb8eab3e835d8d1 /test/console | |
parent | 20faca581a3b832301c9dca3074b0f61ba163d62 (diff) |
Separate Message to InfoMessage and ErrorMessage
Diffstat (limited to 'test/console')
-rw-r--r-- | test/console/components/ErrorMessage.test.tsx | 17 | ||||
-rw-r--r-- | test/console/components/InfoMessage.test.tsx | 17 | ||||
-rw-r--r-- | test/console/components/console/Message.test.tsx | 27 |
3 files changed, 34 insertions, 27 deletions
diff --git a/test/console/components/ErrorMessage.test.tsx b/test/console/components/ErrorMessage.test.tsx new file mode 100644 index 0000000..46ec0b0 --- /dev/null +++ b/test/console/components/ErrorMessage.test.tsx @@ -0,0 +1,17 @@ +import React from "react"; +import ReactTestRenderer from "react-test-renderer"; +import { expect } from "chai"; +import ErrorMessage from "../../../src/console/components/ErrorMessage"; + +describe("console/components/console/completion/ErrorMessage", () => { + it("renders an error message", () => { + const root = ReactTestRenderer.create( + <ErrorMessage mode="error">Hello!</ErrorMessage> + ).root; + + const p = root.findByType("p"); + + expect(p.props["role"]).to.equal("alert"); + expect(p.children).to.deep.equal(["Hello!"]); + }); +}); diff --git a/test/console/components/InfoMessage.test.tsx b/test/console/components/InfoMessage.test.tsx new file mode 100644 index 0000000..5b678ff --- /dev/null +++ b/test/console/components/InfoMessage.test.tsx @@ -0,0 +1,17 @@ +import React from "react"; +import ReactTestRenderer from "react-test-renderer"; +import { expect } from "chai"; +import InfoMessage from "../../../src/console/components/InfoMessage"; + +describe("console/components/console/completion/InfoMessage", () => { + it("renders an information message", () => { + const root = ReactTestRenderer.create( + <InfoMessage mode="info">Hello!</InfoMessage> + ).root; + + const p = root.findByType("p"); + + expect(p.props["role"]).to.equal("status"); + expect(p.children).to.deep.equal(["Hello!"]); + }); +}); diff --git a/test/console/components/console/Message.test.tsx b/test/console/components/console/Message.test.tsx deleted file mode 100644 index f8f950a..0000000 --- a/test/console/components/console/Message.test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; -import ReactTestRenderer from "react-test-renderer"; -import { expect } from "chai"; -import Message from "../../../../src/console/components/console/Message"; - -describe("console/components/console/completion/Message", () => { - it("renders an information message", () => { - const root = ReactTestRenderer.create(<Message mode="info">Hello!</Message>) - .root; - - const p = root.findByType("p"); - - expect(p.props["role"]).to.equal("status"); - expect(p.children).to.deep.equal(["Hello!"]); - }); - - it("renders an error message", () => { - const root = ReactTestRenderer.create( - <Message mode="error">Hello!</Message> - ).root; - - const p = root.findByType("p"); - - expect(p.props["role"]).to.equal("alert"); - expect(p.children).to.deep.equal(["Hello!"]); - }); -}); |