Merge pull request #312 from Citrinin/add-header-tests
[add]: a unit test for header component
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Header renders correctly 1`] = `
|
||||
<div
|
||||
className="shadow flex items-center justify-center flex-col mb-2 py-2"
|
||||
>
|
||||
<a
|
||||
href="/"
|
||||
>
|
||||
<h1
|
||||
className="text-base font-bold font-title sm:text-2xl font-medium text-blue-800 flex justify-center items-center flex-col"
|
||||
>
|
||||
<img
|
||||
alt="github profile markdown generator logo"
|
||||
className="w-12 h-12"
|
||||
src="test-file-stub"
|
||||
/>
|
||||
<div>
|
||||
heading
|
||||
</div>
|
||||
</h1>
|
||||
</a>
|
||||
<div
|
||||
className="flex justify-center items-center"
|
||||
>
|
||||
<a
|
||||
aria-label="Star rahuldkjain/github-profile-readme-generator on GitHub"
|
||||
className="mr-2"
|
||||
href="https://github.com/rahuldkjain/github-profile-readme-generator"
|
||||
target="blank"
|
||||
>
|
||||
<div
|
||||
className="text-xxs sm:text-sm border-2 border-solid border-gray-900 bg-gray-100 flex items-center justify-center py-1 px-2"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
className="px-1 w-6 star"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<path fill-rule=\\"evenodd\\" d=\\"M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z\\"></path>",
|
||||
}
|
||||
}
|
||||
fill="currentColor"
|
||||
height={16}
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
"display": "inline-block",
|
||||
"userSelect": "none",
|
||||
"verticalAlign": "text-bottom",
|
||||
}
|
||||
}
|
||||
viewBox="0 0 16 16"
|
||||
width={16}
|
||||
/>
|
||||
Star this repo
|
||||
<span
|
||||
className="github-count px-1 sm:px-2"
|
||||
>
|
||||
0
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
<a
|
||||
aria-label="Fork rahuldkjain/github-profile-readme-generator on GitHub"
|
||||
href="https://github.com/rahuldkjain/github-profile-readme-generator/fork"
|
||||
target="blank"
|
||||
>
|
||||
<div
|
||||
className="text-xxs sm:text-sm border-2 border-solid border-gray-900 bg-gray-100 flex items-center justify-center py-1 px-2"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
className="px-1 w-6 fork"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<path fill-rule=\\"evenodd\\" d=\\"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z\\"></path>",
|
||||
}
|
||||
}
|
||||
fill="currentColor"
|
||||
height={16}
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
"display": "inline-block",
|
||||
"userSelect": "none",
|
||||
"verticalAlign": "text-bottom",
|
||||
}
|
||||
}
|
||||
viewBox="0 0 16 16"
|
||||
width={16}
|
||||
/>
|
||||
Fork on GitHub
|
||||
<span
|
||||
className="github-count px-1 sm:px-2"
|
||||
>
|
||||
0
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,13 @@
|
||||
import React from "react"
|
||||
import renderer from "react-test-renderer"
|
||||
|
||||
import Header from "../header"
|
||||
|
||||
describe("Header", () => {
|
||||
it("renders correctly", () => {
|
||||
const tree = renderer
|
||||
.create(<Header heading="heading" />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user