Added unit test for subtitle component

This commit is contained in:
Ankur Chaudhary
2020-10-23 20:52:39 +05:30
parent 1c45d54dff
commit 784710be47
3 changed files with 33 additions and 1 deletions
+1 -1
View File
@@ -28673,4 +28673,4 @@
"integrity": "sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw=="
}
}
}
}
@@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Subtitle renders correctly 1`] = `
<div
className="flex justify-center items-start flex-col w-full px-2 sm:px-6 mb-10"
>
<div
className="text-xl sm:text-2xl font-bold font-title mt-2 mb-2"
>
Subtitle
</div>
<input
className="outline-none w-full text-xs sm:text-lg sm:w-1/2 border-t-0 border-l-0 border-r-0 border solid border-gray-900 py-1 px-2 focus:border-blue-700"
id="subtitle"
onChange={[Function]}
value="A passionate frontend developer from India"
/>
</div>
`;
+13
View File
@@ -0,0 +1,13 @@
import React from "react"
import renderer from "react-test-renderer"
import Subtitle from "../subtitle"
describe("Subtitle", () => {
it("renders correctly", () => {
const tree = renderer
.create(<Subtitle data={{ subtitle: "A passionate frontend developer from India" }} />)
.toJSON()
expect(tree).toMatchSnapshot()
})
})