Added Test for markdownPreview and its subcomponents
This commit is contained in:
@@ -8,7 +8,7 @@ exports[`Footer component Matches the snapshot 1`] = `
|
||||
className="w-full flex flex-col sm:flex-row justify-evenly py-2"
|
||||
>
|
||||
<div
|
||||
className="ml-2 sm:ml-0 sm:mr-6 order-last sm:order-none flex"
|
||||
className="sm:ml-0 sm:mr-6 order-last sm:order-none flex"
|
||||
>
|
||||
<h1
|
||||
className="text-base font-bold font-title text-xl sm:text-2xl mt-3 sm:mt-0"
|
||||
@@ -110,7 +110,9 @@ exports[`Footer component Matches the snapshot 1`] = `
|
||||
Releases
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
className="ml-2 sm:ml-0"
|
||||
>
|
||||
<a
|
||||
aria-label="Issues in rahuldkjain/github-profile-readme-generator"
|
||||
href="https://github.com/rahuldkjain/github-profile-readme-generator/issues"
|
||||
@@ -119,7 +121,9 @@ exports[`Footer component Matches the snapshot 1`] = `
|
||||
Issues
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
className="ml-2 sm:ml-0"
|
||||
>
|
||||
<a
|
||||
aria-label="Pull Requests in rahuldkjain/github-profile-readme-generator"
|
||||
href="https://github.com/rahuldkjain/github-profile-readme-generator/pulls"
|
||||
@@ -137,7 +141,9 @@ exports[`Footer component Matches the snapshot 1`] = `
|
||||
Join Community
|
||||
</strong>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
class="ml-2 sm:ml-0"
|
||||
>
|
||||
<a
|
||||
aria-label="Discord of the community"
|
||||
href="https://discord.gg/HHMs7Eg"
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`DisplaySocial Preview renders correctly 1`] = `
|
||||
<a
|
||||
className="no-underline text-blue-700 m-2"
|
||||
href="https://codepen.io/dummy"
|
||||
target="blank"
|
||||
>
|
||||
<img
|
||||
alt="props.username"
|
||||
className="w-6 h-6"
|
||||
src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg"
|
||||
/>
|
||||
</a>
|
||||
`;
|
||||
|
||||
exports[`DisplaySocial Preview renders correctly with no username 1`] = `null`;
|
||||
|
||||
exports[`DisplayWork Preview renders correctly 1`] = `
|
||||
<div
|
||||
className="my-2"
|
||||
>
|
||||
[object Object]
|
||||
<a
|
||||
className="no-underline text-blue-700"
|
||||
href="https://dummy.com"
|
||||
target="blank"
|
||||
>
|
||||
readme-generator
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`DisplayWork Preview renders correctly with no link 1`] = `
|
||||
<div
|
||||
className="my-2"
|
||||
>
|
||||
[object Object]
|
||||
<b>
|
||||
readme-generator
|
||||
</b>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`DisplayWork Preview renders correctly with no prefix 1`] = `null`;
|
||||
|
||||
exports[`DisplayWork Preview renders correctly with no prefix and link 1`] = `null`;
|
||||
|
||||
exports[`DisplayWork Preview renders correctly with no prefix, link and project 1`] = `null`;
|
||||
|
||||
exports[`DisplayWork Preview renders correctly with no project 1`] = `
|
||||
<div
|
||||
className="my-2"
|
||||
>
|
||||
[object Object]
|
||||
<a
|
||||
className="no-underline text-blue-700"
|
||||
href="https://dummy.com"
|
||||
target="blank"
|
||||
>
|
||||
https://dummy.com
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`DisplayWork Preview renders correctly with no project and link 1`] = `null`;
|
||||
|
||||
exports[`DisplayWork Preview renders correctly with no project and prefix 1`] = `null`;
|
||||
|
||||
exports[`GitHubStats Preview renders correctly 1`] = `null`;
|
||||
|
||||
exports[`GitHubStats Preview renders correctly 2`] = `
|
||||
<div
|
||||
className="text-center mx-4 mb-4"
|
||||
>
|
||||
<img
|
||||
alt=""
|
||||
src="https://github-readme-stats.vercel.app/api?username=&show_icons=true&locale=en"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`GithubProfileTrophy Preview renders correctly 1`] = `null`;
|
||||
|
||||
exports[`GithubProfileTrophy Preview renders correctly with show true 1`] = `
|
||||
<div
|
||||
className="text-left my-2"
|
||||
>
|
||||
|
||||
<a
|
||||
href="https://github.com/ryo-ma/github-profile-trophy"
|
||||
>
|
||||
<img
|
||||
alt=""
|
||||
src="https://github-profile-trophy.vercel.app/?username="
|
||||
/>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renders correctly 1`] = `
|
||||
<div
|
||||
id="markdown-preview"
|
||||
>
|
||||
<h1
|
||||
className="text-center text-xl font-bold"
|
||||
>
|
||||
Hi 👋, I'm dummy
|
||||
</h1>
|
||||
<h3
|
||||
className="text-center font-medium"
|
||||
>
|
||||
A passionate frontend developer from India
|
||||
</h3>
|
||||
<div
|
||||
className="my-2"
|
||||
>
|
||||
🔭 I’m currently working on
|
||||
<a
|
||||
className="no-underline text-blue-700"
|
||||
href="https://dummy.com"
|
||||
target="blank"
|
||||
>
|
||||
readme-generator
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
className="flex justify-start items-end flex-wrap"
|
||||
>
|
||||
<h3
|
||||
className="w-full text-lg sm:text-xl"
|
||||
>
|
||||
Connect with me:
|
||||
</h3>
|
||||
<a
|
||||
className="no-underline text-blue-700 m-2"
|
||||
href="https://codepen.io/dummy"
|
||||
target="blank"
|
||||
>
|
||||
<img
|
||||
alt="props.username"
|
||||
className="w-6 h-6"
|
||||
src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="block sm:flex sm:justify-center sm:items-start"
|
||||
>
|
||||
<div
|
||||
className="text-center mx-4 mb-4"
|
||||
>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`SectionTitle Preview renders correctly 1`] = `
|
||||
<h3
|
||||
className="w-full text-lg sm:text-xl"
|
||||
>
|
||||
dummy
|
||||
</h3>
|
||||
`;
|
||||
|
||||
exports[`SectionTitle Preview renders correctly with no label 1`] = `null`;
|
||||
|
||||
exports[`SectionTitle Preview renders correctly with visible false 1`] = `null`;
|
||||
|
||||
exports[`Skills Preview renders correctly 1`] = `
|
||||
<div
|
||||
className="flex flex-wrap justify-start items-center"
|
||||
>
|
||||
<h3
|
||||
className="w-full text-lg sm:text-xl"
|
||||
>
|
||||
Languages and Tools:
|
||||
</h3>
|
||||
<a
|
||||
href="https://unity.com/"
|
||||
rel="noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<img
|
||||
alt="unity"
|
||||
className="mb-4 mr-4 h-6 w-6 sm:h-10 sm:w-10"
|
||||
src="https://www.vectorlogo.zone/logos/unity3d/unity3d-icon.svg"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Skills Preview renders correctly with no skills 1`] = `""`;
|
||||
|
||||
exports[`Social Preview renders correctly 1`] = `
|
||||
<div
|
||||
className="flex justify-start items-end flex-wrap"
|
||||
>
|
||||
<h3
|
||||
className="w-full text-lg sm:text-xl"
|
||||
>
|
||||
Connect with me:
|
||||
</h3>
|
||||
<a
|
||||
className="no-underline text-blue-700 m-2"
|
||||
href="https://codepen.io/dummy"
|
||||
target="blank"
|
||||
>
|
||||
<img
|
||||
alt="props.username"
|
||||
className="w-6 h-6"
|
||||
src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`SubTitle Preview renders correctly 1`] = `
|
||||
<h3
|
||||
className="text-center font-medium"
|
||||
>
|
||||
A passionate frontend developer from India
|
||||
</h3>
|
||||
`;
|
||||
|
||||
exports[`SubTitle Preview renders correctly with no subtitle 1`] = `null`;
|
||||
|
||||
exports[`Title Preview renders correctly 1`] = `
|
||||
<h1
|
||||
className="text-center text-xl font-bold"
|
||||
>
|
||||
Hi 👋, I'm dummy
|
||||
</h1>
|
||||
`;
|
||||
|
||||
exports[`Title Preview renders correctly with no prefix 1`] = `null`;
|
||||
|
||||
exports[`Title Preview renders correctly with no title 1`] = `null`;
|
||||
|
||||
exports[`Title Preview renders correctly with no title and prefix 1`] = `null`;
|
||||
|
||||
exports[`TopLanguages Preview renders correctly 1`] = `
|
||||
<div
|
||||
className="text-center mx-4 mb-4"
|
||||
>
|
||||
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`TopLanguages Preview renders correctly with show true 1`] = `
|
||||
<div
|
||||
className="text-center mx-4 mb-4"
|
||||
>
|
||||
<img
|
||||
alt=""
|
||||
src="https://github-readme-stats.vercel.app/api/top-langs?username=&show_icons=true&locale=en&layout=compact"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`TwitterBadgePreview Preview renders correctly 1`] = `null`;
|
||||
|
||||
exports[`TwitterBadgePreview Preview renders correctly with show true 1`] = `
|
||||
<div
|
||||
className="text-left my-2"
|
||||
>
|
||||
|
||||
<a
|
||||
href="https://twitter.com/\${props.twitter}"
|
||||
target="blank"
|
||||
>
|
||||
<img
|
||||
alt=""
|
||||
className="h-4 sm:h-6"
|
||||
src="https://img.shields.io/twitter/follow/?logo=twitter&style=for-the-badge"
|
||||
/>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`VisitorsBadge Preview renders correctly 1`] = `null`;
|
||||
|
||||
exports[`VisitorsBadge Preview renders correctly with show true 1`] = `
|
||||
<div
|
||||
className="text-left my-2"
|
||||
>
|
||||
|
||||
<img
|
||||
alt=""
|
||||
className="h-4 sm:h-6"
|
||||
src="https://komarev.com/ghpvc/?username=&label=Profile%20views&color=0e75b6&style=flat"
|
||||
/>
|
||||
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Work Preview renders correctly 1`] = `
|
||||
<div
|
||||
className="my-2"
|
||||
>
|
||||
🔭 I’m currently working on
|
||||
<a
|
||||
className="no-underline text-blue-700"
|
||||
href="https://dummy.com"
|
||||
target="blank"
|
||||
>
|
||||
readme-generator
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,447 @@
|
||||
import React from "react";
|
||||
import renderer from "react-test-renderer";
|
||||
|
||||
import MarkdownPreview, { GithubProfileTrophyPreview, GitHubStatsPreview, SkillsPreview, SocialPreview, SubTitlePreview, TitlePreview, TopLanguagesPreview, TwitterBadgePreview, VisitorsBadgePreview, WorkPreview, SectionTitle, DisplayWork, DisplaySocial } from "../markdownPreview"
|
||||
|
||||
const DEFAULT_PREFIX = {
|
||||
title: "Hi 👋, I'm",
|
||||
currentWork: "🔭 I’m currently working on",
|
||||
currentLearn: "🌱 I’m currently learning",
|
||||
collaborateOn: "👯 I’m looking to collaborate on",
|
||||
helpWith: "🤝 I’m looking for help with",
|
||||
ama: "💬 Ask me about",
|
||||
contact: "📫 How to reach me",
|
||||
resume: "📄 Know about my experiences",
|
||||
funFact: "⚡ Fun fact",
|
||||
portfolio: "👨💻 All of my projects are available at",
|
||||
blog: "📝 I regulary write articles on",
|
||||
}
|
||||
|
||||
const DEFAULT_DATA = {
|
||||
title: "dummy",
|
||||
subtitle: "A passionate frontend developer from India",
|
||||
currentWork: "readme-generator",
|
||||
currentLearn: "",
|
||||
collaborateOn: "",
|
||||
helpWith: "",
|
||||
ama: "",
|
||||
contact: "",
|
||||
funFact: "",
|
||||
twitterBadge: false,
|
||||
visitorsBadge: false,
|
||||
badgeStyle: "flat",
|
||||
badgeColor: "0e75b6",
|
||||
badgeLabel: "Profile views",
|
||||
githubProfileTrophy: false,
|
||||
githubStats: false,
|
||||
githubStatsOptions: {
|
||||
theme: "",
|
||||
titleColor: "",
|
||||
textColor: "",
|
||||
bgColor: "",
|
||||
hideBorder: false,
|
||||
cacheSeconds: null,
|
||||
locale: "en",
|
||||
},
|
||||
topLanguages: false,
|
||||
topLanguagesOptions: {
|
||||
theme: "",
|
||||
titleColor: "",
|
||||
textColor: "",
|
||||
bgColor: "",
|
||||
hideBorder: false,
|
||||
cacheSeconds: null,
|
||||
locale: "en",
|
||||
},
|
||||
devDynamicBlogs: false,
|
||||
mediumDynamicBlogs: false,
|
||||
rssDynamicBlogs: false,
|
||||
}
|
||||
|
||||
const DEFAULT_LINK = {
|
||||
currentWork: "https://dummy.com",
|
||||
collaborateOn: "",
|
||||
helpWith: "",
|
||||
portfolio: "",
|
||||
blog: "",
|
||||
resume: "",
|
||||
}
|
||||
|
||||
const DEFAULT_SOCIAL = {
|
||||
github: "",
|
||||
dev: "",
|
||||
linkedin: "",
|
||||
codepen: "dummy",
|
||||
stackoverflow: "",
|
||||
kaggle: "",
|
||||
codesandbox: "",
|
||||
fb: "",
|
||||
instagram: "",
|
||||
twitter: "",
|
||||
dribbble: "",
|
||||
behance: "",
|
||||
medium: "",
|
||||
youtube: "",
|
||||
codechef: "",
|
||||
hackerrank: "",
|
||||
codeforces: "",
|
||||
leetcode: "",
|
||||
topcoder: "",
|
||||
hackerearth: "",
|
||||
geeks_for_geeks: "",
|
||||
discord: "",
|
||||
rssurl: "",
|
||||
}
|
||||
|
||||
const DUMMY_SKILLS = {
|
||||
skills: {
|
||||
unity: true,
|
||||
android: false,
|
||||
angularjs: false,
|
||||
apachecordova: false,
|
||||
}
|
||||
}
|
||||
|
||||
describe("Markdown Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let prefix = DEFAULT_PREFIX;
|
||||
let data = DEFAULT_DATA;
|
||||
let link = DEFAULT_LINK;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
let skills = {}
|
||||
const tree = renderer
|
||||
.create(<MarkdownPreview
|
||||
prefix={prefix}
|
||||
data={data}
|
||||
link={link}
|
||||
social={social}
|
||||
skills={skills} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("Title Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let prefix = DEFAULT_PREFIX;
|
||||
let data = DEFAULT_DATA;
|
||||
const tree = renderer
|
||||
.create(<TitlePreview prefix={prefix.title} title={data.title} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no prefix", () => {
|
||||
let prefix = DEFAULT_PREFIX;
|
||||
const tree = renderer
|
||||
.create(<TitlePreview prefix={prefix.title} title={""} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no title", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
const tree = renderer
|
||||
.create(<TitlePreview title={data.title} prefix={""} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no title and prefix", () => {
|
||||
const tree = renderer
|
||||
.create(<TitlePreview />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("SubTitle Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
const tree = renderer
|
||||
.create(<SubTitlePreview subtitle={data.subtitle} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no subtitle", () => {
|
||||
const tree = renderer
|
||||
.create(<SubTitlePreview subtitle={""} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("SectionTitle Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
const tree = renderer
|
||||
.create(<SectionTitle visible={true} label={"dummy"} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no label", () => {
|
||||
const tree = renderer
|
||||
.create(<SectionTitle visible={true} label={""} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with visible false", () => {
|
||||
const tree = renderer
|
||||
.create(<SectionTitle visible={false} label={"dummy"} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("DisplayWork Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let prefix = DEFAULT_PREFIX;
|
||||
let data = DEFAULT_DATA;
|
||||
let link = DEFAULT_LINK;
|
||||
const tree = renderer
|
||||
.create(<DisplayWork prefix={prefix} project={data.currentWork} link={link.currentWork} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no prefix, link and project", () => {
|
||||
const tree = renderer
|
||||
.create(<DisplayWork prefix={undefined} project={undefined} link={undefined} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no prefix", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let link = DEFAULT_LINK;
|
||||
const tree = renderer
|
||||
.create(<DisplayWork prefix={undefined} project={data.currentWork} link={link.currentWork} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no project", () => {
|
||||
let prefix = DEFAULT_PREFIX;
|
||||
let link = DEFAULT_LINK;
|
||||
const tree = renderer
|
||||
.create(<DisplayWork prefix={prefix} project={undefined} link={link.currentWork} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no link", () => {
|
||||
let prefix = DEFAULT_PREFIX;
|
||||
let data = DEFAULT_DATA;
|
||||
const tree = renderer
|
||||
.create(<DisplayWork prefix={prefix} project={data.currentWork} link={undefined}/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no prefix and link", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
const tree = renderer
|
||||
.create(<DisplayWork project={data.currentWork} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no project and link", () => {
|
||||
let prefix = DEFAULT_PREFIX;
|
||||
const tree = renderer
|
||||
.create(<DisplayWork prefix={prefix} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no project and prefix", () => {
|
||||
let link = DEFAULT_LINK;
|
||||
const tree = renderer
|
||||
.create(<DisplayWork link={link.currentWork} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("DisplaySocial Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<DisplaySocial
|
||||
base="https://codepen.io"
|
||||
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg"
|
||||
username={social.codepen}
|
||||
/>
|
||||
)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no username", () => {
|
||||
const tree = renderer
|
||||
.create(<DisplaySocial
|
||||
base="https://codepen.io"
|
||||
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg"
|
||||
username={""}
|
||||
/>
|
||||
)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("VisitorsBadge Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<VisitorsBadgePreview
|
||||
show={data.visitorsBadge}
|
||||
github={social.github}
|
||||
badgeOptions={{
|
||||
badgeLabel: encodeURI(data.badgeLabel),
|
||||
badgeColor: data.badgeColor,
|
||||
badgeStyle: data.badgeStyle,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with show true", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<VisitorsBadgePreview
|
||||
show={true}
|
||||
github={social.github}
|
||||
badgeOptions={{
|
||||
badgeLabel: encodeURI(data.badgeLabel),
|
||||
badgeColor: data.badgeColor,
|
||||
badgeStyle: data.badgeStyle,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("GithubProfileTrophy Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<GithubProfileTrophyPreview
|
||||
show={data.githubProfileTrophy}
|
||||
github={social.github}
|
||||
/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with show true", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<GithubProfileTrophyPreview
|
||||
show={true}
|
||||
github={social.github}
|
||||
/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("TwitterBadgePreview Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<TwitterBadgePreview
|
||||
show={data.twitterBadge}
|
||||
twitter={social.twitter}
|
||||
/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with show true", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<TwitterBadgePreview
|
||||
show={true}
|
||||
twitter={social.twitter}
|
||||
/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("Work Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let prefix = DEFAULT_PREFIX;
|
||||
let link = DEFAULT_LINK;
|
||||
let props = { data: data, prefix: prefix, link: link }
|
||||
const tree = renderer
|
||||
.create(<WorkPreview work={props} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("Social Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<SocialPreview social={social} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("Skills Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let skills = DUMMY_SKILLS.skills
|
||||
const tree = renderer
|
||||
.create(<SkillsPreview skills={skills} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with no skills", () => {
|
||||
let skills = {}
|
||||
const tree = renderer
|
||||
.create(<SkillsPreview skills={skills} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("TopLanguages Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<TopLanguagesPreview
|
||||
show={data.topLanguages}
|
||||
github={social.github}
|
||||
options={data.topLanguagesOptions}
|
||||
/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly with show true", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<TopLanguagesPreview
|
||||
show={true}
|
||||
github={social.github}
|
||||
options={data.topLanguagesOptions}
|
||||
/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
describe("GitHubStats Preview", () => {
|
||||
it("renders correctly", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<GitHubStatsPreview
|
||||
show={data.githubStats}
|
||||
github={social.github}
|
||||
options={data.githubStatsOptions}
|
||||
/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
it("renders correctly", () => {
|
||||
let data = DEFAULT_DATA;
|
||||
let social = DEFAULT_SOCIAL;
|
||||
const tree = renderer
|
||||
.create(<GitHubStatsPreview
|
||||
show={true}
|
||||
github={social.github}
|
||||
options={data.githubStatsOptions}
|
||||
/>)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user