Adding unit tests

This commit is contained in:
Damien Chazoule
2021-10-04 10:08:00 +02:00
parent 20b47a9c3d
commit f0a9d02f26
6 changed files with 553 additions and 260 deletions
@@ -99,6 +99,24 @@ exports[`Addons renders correctly 1`] = `
>
display top skills
</AddonsItem>
<AddonsItem
Options={
<CustomizeOptions
CustomizationOptions={
<CustomizeStreakStats
onUpdate={[Function]}
options={Object {}}
prefix="streak-stats"
/>
}
title="Customize Streak Stats Card"
/>
}
inputId="streak-stats"
onInputChange={[Function]}
>
display github streak stats
</AddonsItem>
<AddonsItem
inputChecked={false}
inputId="twitter-badge"
@@ -699,6 +717,80 @@ exports[`Addons should render Customize Badges 1`] = `
</button>
</div>
</AddonsItem>
<AddonsItem
Options={
<CustomizeOptions
CustomizationOptions={
<CustomizeStreakStats
onUpdate={[Function]}
options={Object {}}
prefix="streak-stats"
/>
}
title="Customize Streak Stats Card"
/>
}
inputId="streak-stats"
onInputChange={[Function]}
>
<div
className="py-2 flex justify-start items-center text-sm sm:text-lg"
>
<label
className="cursor-pointer flex items-center"
htmlFor="streak-stats"
>
<input
id="streak-stats"
onChange={[Function]}
type="checkbox"
/>
<span
className="pl-4"
>
display github streak stats
</span>
</label>
<button
className="flex ml-3 focus:bg-gray-400"
id="streak-stats-open-btn"
onClick={[Function]}
style={
Object {
"outline": "none",
}
}
>
<ToolsIcon
className="transform scale-100 md:scale-125"
size={16}
verticalAlign="text-bottom"
>
<svg
aria-hidden="true"
className="transform scale-100 md:scale-125"
dangerouslySetInnerHTML={
Object {
"__html": "<path fill-rule=\\"evenodd\\" d=\\"M5.433 2.304A4.494 4.494 0 003.5 6c0 1.598.832 3.002 2.09 3.802.518.328.929.923.902 1.64v.008l-.164 3.337a.75.75 0 11-1.498-.073l.163-3.33c.002-.085-.05-.216-.207-.316A5.996 5.996 0 012 6a5.994 5.994 0 012.567-4.92 1.482 1.482 0 011.673-.04c.462.296.76.827.76 1.423v2.82c0 .082.041.16.11.206l.75.51a.25.25 0 00.28 0l.75-.51A.25.25 0 009 5.282V2.463c0-.596.298-1.127.76-1.423a1.482 1.482 0 011.673.04A5.994 5.994 0 0114 6a5.996 5.996 0 01-2.786 5.068c-.157.1-.209.23-.207.315l.163 3.33a.75.75 0 11-1.498.074l-.164-3.345c-.027-.717.384-1.312.902-1.64A4.496 4.496 0 0012.5 6a4.494 4.494 0 00-1.933-3.696c-.024.017-.067.067-.067.16v2.818a1.75 1.75 0 01-.767 1.448l-.75.51a1.75 1.75 0 01-1.966 0l-.75-.51A1.75 1.75 0 015.5 5.282V2.463c0-.092-.043-.142-.067-.159zm.01-.005z\\"></path>",
}
}
fill="currentColor"
height={16}
role="img"
style={
Object {
"display": "inline-block",
"userSelect": "none",
"verticalAlign": "text-bottom",
}
}
viewBox="0 0 16 16"
width={16}
/>
</ToolsIcon>
</button>
</div>
</AddonsItem>
<AddonsItem
inputChecked={false}
inputId="twitter-badge"
@@ -1382,6 +1474,80 @@ exports[`Addons should render Customize Github stats card 1`] = `
</button>
</div>
</AddonsItem>
<AddonsItem
Options={
<CustomizeOptions
CustomizationOptions={
<CustomizeStreakStats
onUpdate={[Function]}
options={Object {}}
prefix="streak-stats"
/>
}
title="Customize Streak Stats Card"
/>
}
inputId="streak-stats"
onInputChange={[Function]}
>
<div
className="py-2 flex justify-start items-center text-sm sm:text-lg"
>
<label
className="cursor-pointer flex items-center"
htmlFor="streak-stats"
>
<input
id="streak-stats"
onChange={[Function]}
type="checkbox"
/>
<span
className="pl-4"
>
display github streak stats
</span>
</label>
<button
className="flex ml-3 focus:bg-gray-400"
id="streak-stats-open-btn"
onClick={[Function]}
style={
Object {
"outline": "none",
}
}
>
<ToolsIcon
className="transform scale-100 md:scale-125"
size={16}
verticalAlign="text-bottom"
>
<svg
aria-hidden="true"
className="transform scale-100 md:scale-125"
dangerouslySetInnerHTML={
Object {
"__html": "<path fill-rule=\\"evenodd\\" d=\\"M5.433 2.304A4.494 4.494 0 003.5 6c0 1.598.832 3.002 2.09 3.802.518.328.929.923.902 1.64v.008l-.164 3.337a.75.75 0 11-1.498-.073l.163-3.33c.002-.085-.05-.216-.207-.316A5.996 5.996 0 012 6a5.994 5.994 0 012.567-4.92 1.482 1.482 0 011.673-.04c.462.296.76.827.76 1.423v2.82c0 .082.041.16.11.206l.75.51a.25.25 0 00.28 0l.75-.51A.25.25 0 009 5.282V2.463c0-.596.298-1.127.76-1.423a1.482 1.482 0 011.673.04A5.994 5.994 0 0114 6a5.996 5.996 0 01-2.786 5.068c-.157.1-.209.23-.207.315l.163 3.33a.75.75 0 11-1.498.074l-.164-3.345c-.027-.717.384-1.312.902-1.64A4.496 4.496 0 0012.5 6a4.494 4.494 0 00-1.933-3.696c-.024.017-.067.067-.067.16v2.818a1.75 1.75 0 01-.767 1.448l-.75.51a1.75 1.75 0 01-1.966 0l-.75-.51A1.75 1.75 0 015.5 5.282V2.463c0-.092-.043-.142-.067-.159zm.01-.005z\\"></path>",
}
}
fill="currentColor"
height={16}
role="img"
style={
Object {
"display": "inline-block",
"userSelect": "none",
"verticalAlign": "text-bottom",
}
}
viewBox="0 0 16 16"
width={16}
/>
</ToolsIcon>
</button>
</div>
</AddonsItem>
<AddonsItem
inputChecked={false}
inputId="twitter-badge"
@@ -2065,6 +2231,80 @@ exports[`Addons should render Customize Top Skills Card 1`] = `
</div>
</CustomizeOptions>
</AddonsItem>
<AddonsItem
Options={
<CustomizeOptions
CustomizationOptions={
<CustomizeStreakStats
onUpdate={[Function]}
options={Object {}}
prefix="streak-stats"
/>
}
title="Customize Streak Stats Card"
/>
}
inputId="streak-stats"
onInputChange={[Function]}
>
<div
className="py-2 flex justify-start items-center text-sm sm:text-lg"
>
<label
className="cursor-pointer flex items-center"
htmlFor="streak-stats"
>
<input
id="streak-stats"
onChange={[Function]}
type="checkbox"
/>
<span
className="pl-4"
>
display github streak stats
</span>
</label>
<button
className="flex ml-3 focus:bg-gray-400"
id="streak-stats-open-btn"
onClick={[Function]}
style={
Object {
"outline": "none",
}
}
>
<ToolsIcon
className="transform scale-100 md:scale-125"
size={16}
verticalAlign="text-bottom"
>
<svg
aria-hidden="true"
className="transform scale-100 md:scale-125"
dangerouslySetInnerHTML={
Object {
"__html": "<path fill-rule=\\"evenodd\\" d=\\"M5.433 2.304A4.494 4.494 0 003.5 6c0 1.598.832 3.002 2.09 3.802.518.328.929.923.902 1.64v.008l-.164 3.337a.75.75 0 11-1.498-.073l.163-3.33c.002-.085-.05-.216-.207-.316A5.996 5.996 0 012 6a5.994 5.994 0 012.567-4.92 1.482 1.482 0 011.673-.04c.462.296.76.827.76 1.423v2.82c0 .082.041.16.11.206l.75.51a.25.25 0 00.28 0l.75-.51A.25.25 0 009 5.282V2.463c0-.596.298-1.127.76-1.423a1.482 1.482 0 011.673.04A5.994 5.994 0 0114 6a5.996 5.996 0 01-2.786 5.068c-.157.1-.209.23-.207.315l.163 3.33a.75.75 0 11-1.498.074l-.164-3.345c-.027-.717.384-1.312.902-1.64A4.496 4.496 0 0012.5 6a4.494 4.494 0 00-1.933-3.696c-.024.017-.067.067-.067.16v2.818a1.75 1.75 0 01-.767 1.448l-.75.51a1.75 1.75 0 01-1.966 0l-.75-.51A1.75 1.75 0 015.5 5.282V2.463c0-.092-.043-.142-.067-.159zm.01-.005z\\"></path>",
}
}
fill="currentColor"
height={16}
role="img"
style={
Object {
"display": "inline-block",
"userSelect": "none",
"verticalAlign": "text-bottom",
}
}
viewBox="0 0 16 16"
width={16}
/>
</ToolsIcon>
</button>
</div>
</AddonsItem>
<AddonsItem
inputChecked={false}
inputId="twitter-badge"
@@ -71,17 +71,16 @@ exports[`Donate renders correctly 1`] = `
Buy me a ko-fi
</a>
<a
className="flex items-center justify-evenly bg-blue-500 text-white py-2 px-4 my-2"
className="flex items-center justify-evenly bg-white-500 text-white py-2 px-4 my-2 border border-solid"
href="https://www.paypal.me/rahuldkjain/10"
rel="noreferrer"
target="_blank"
>
<img
alt="Donate rahuldkjain via paypal"
className="w-6 h-6 mr-2"
src="https://www.vectorlogo.zone/logos/paypal/paypal-ar21.svg"
className="w-32 h-4"
src="https://cdn.worldvectorlogo.com/logos/paypal-2.svg"
/>
Paypal
</a>
<a
className="flex items-center justify-evenly bg-orange-500 text-white py-2 px-4 my-2"
@@ -157,7 +157,7 @@ exports[`Footer component renders correctly 1`] = `
</strong>
</div>
<div
class="ml-2 sm:ml-0"
className="ml-2 sm:ml-0"
>
<a
aria-label="Discord of the community"
File diff suppressed because it is too large Load Diff
@@ -20,7 +20,7 @@ exports[`DisplayWork Preview renders correctly 1`] = `
<div
className="my-2"
>
[object Object]
[object Object]
<a
className="no-underline text-blue-700"
href="https://dummy.com"
@@ -35,7 +35,7 @@ exports[`DisplayWork Preview renders correctly with no link 1`] = `
<div
className="my-2"
>
[object Object]
[object Object]
<b>
readme-generator
</b>
@@ -52,7 +52,7 @@ exports[`DisplayWork Preview renders correctly with no project 1`] = `
<div
className="my-2"
>
[object Object]
[object Object]
<a
className="no-underline text-blue-700"
href="https://dummy.com"
@@ -86,7 +86,7 @@ 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"
>
@@ -95,7 +95,7 @@ exports[`GithubProfileTrophy Preview renders correctly with show true 1`] = `
src="https://github-profile-trophy.vercel.app/?username="
/>
</a>
</div>
`;
@@ -254,6 +254,7 @@ exports[`Markdown Preview renders correctly 1`] = `
<SkillsPreview
skills={Object {}}
/>
<SupportPreview />
<div
className="block sm:flex sm:justify-center sm:items-start"
>
@@ -287,6 +288,9 @@ exports[`Markdown Preview renders correctly 1`] = `
}
show={false}
/>
<StreakStatsPreview
github=""
/>
</div>
</div>
`;
@@ -313,13 +317,13 @@ exports[`Skills Preview renders correctly 1`] = `
/>
<a
href="https://unity.com/"
key="unity"
rel="noreferrer"
target="_blank"
>
<img
alt="unity"
className="mb-4 mr-4 h-6 w-6 sm:h-10 sm:w-10"
key="unity"
src="https://www.vectorlogo.zone/logos/unity3d/unity3d-icon.svg"
/>
</a>
@@ -338,112 +342,112 @@ exports[`Social Preview renders correctly 1`] = `
/>
<DisplaySocial
base="https://codepen.io"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/codepen.svg"
username="dummy"
/>
<DisplaySocial
base="https://dev.to"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/dev-dot-to.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/devto.svg"
username=""
/>
<DisplaySocial
base="https://twitter.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/twitter.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/twitter.svg"
username=""
/>
<DisplaySocial
base="https://linkedin.com/in"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/linkedin.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/linked-in-alt.svg"
username=""
/>
<DisplaySocial
base="https://stackoverflow.com/users"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/stackoverflow.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/stack-overflow.svg"
username=""
/>
<DisplaySocial
base="https://codesandbox.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codesandbox.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/codesandbox.svg"
username=""
/>
<DisplaySocial
base="https://kaggle.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/kaggle.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/kaggle.svg"
username=""
/>
<DisplaySocial
base="https://fb.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/facebook.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/facebook.svg"
username=""
/>
<DisplaySocial
base="https://instagram.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/instagram.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/instagram.svg"
username=""
/>
<DisplaySocial
base="https://dribbble.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/dribbble.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/dribbble.svg"
username=""
/>
<DisplaySocial
base="https://www.behance.net"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/behance.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/behance.svg"
username=""
/>
<DisplaySocial
base="https://medium.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/medium.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/medium.svg"
username=""
/>
<DisplaySocial
base="https://www.youtube.com/c"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/youtube.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/youtube.svg"
username=""
/>
<DisplaySocial
base="https://www.codechef.com/users"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codechef.svg"
username=""
/>
<DisplaySocial
base="https://codeforces.com/profile"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codeforces.svg"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.1.0/icons/codechef.svg"
username=""
/>
<DisplaySocial
base="https://www.hackerrank.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/hackerrank.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/hackerrank.svg"
username=""
/>
<DisplaySocial
base="https://auth.geeksforgeeks.org/user"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/geeksforgeeks.svg"
username=""
/>
<DisplaySocial
base="https://www.hackerearth.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/hackerearth.svg"
username=""
/>
<DisplaySocial
base="https://www.topcoder.com/members"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/topcoder.svg"
base="https://codeforces.com/profile"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/codeforces.svg"
username=""
/>
<DisplaySocial
base="https://www.leetcode.com"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/leetcode.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/leet-code.svg"
username=""
/>
<DisplaySocial
base="https://www.hackerearth.com"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/hackerearth.svg"
username=""
/>
<DisplaySocial
base="https://auth.geeksforgeeks.org/user"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/geeks-for-geeks.svg"
username=""
/>
<DisplaySocial
base="https://www.topcoder.com/members"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/topcoder.svg"
username=""
/>
<DisplaySocial
base="https://discord.gg"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/discord.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/discord.svg"
username=""
/>
<DisplaySocial
base=""
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/rss.svg"
icon="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/rss.svg"
username=""
/>
</div>
@@ -498,7 +502,7 @@ exports[`TwitterBadgePreview Preview renders correctly with show true 1`] = `
<div
className="text-left my-2"
>
<a
href="https://twitter.com/\${props.twitter}"
target="blank"
@@ -509,7 +513,7 @@ exports[`TwitterBadgePreview Preview renders correctly with show true 1`] = `
src="https://img.shields.io/twitter/follow/?logo=twitter&style=for-the-badge"
/>
</a>
</div>
`;
@@ -519,13 +523,13 @@ 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>
`;
+30
View File
@@ -0,0 +1,30 @@
import {
isGitHubUsernameValid,
isMediumUsernameValid,
isTwitterUsernameValid,
} from "../validation"
describe("validation", () => {
it("isGitHubUsernameValid", () => {
expect(
isGitHubUsernameValid(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)
).toBe(false)
expect(isGitHubUsernameValid("rahuldkjain")).toBe(true)
})
it("isMediumUsernameValid", () => {
expect(isMediumUsernameValid("rahuldkjain")).toBe(false)
expect(isMediumUsernameValid("@rahuldkjain")).toBe(true)
})
it("isTwitterUsernameValid", () => {
expect(
isTwitterUsernameValid(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit"
)
).toBe(false)
expect(isTwitterUsernameValid("rahuldkjain")).toBe(true)
})
})