import React from "react"; import { shallow, configure } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import MarkdownPreview, { GithubProfileTrophyPreview, GitHubStatsPreview, SkillsPreview, SocialPreview, SubTitlePreview, TitlePreview, TopLanguagesPreview, TwitterBadgePreview, VisitorsBadgePreview, WorkPreview, SectionTitle, DisplayWork, DisplaySocial } from "../markdownPreview" configure({ adapter: new Adapter() }); 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 = shallow() expect(tree).toMatchSnapshot() }) }) describe("Title Preview", () => { it("renders correctly", () => { let prefix = DEFAULT_PREFIX; let data = DEFAULT_DATA; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no prefix", () => { let prefix = DEFAULT_PREFIX; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no title", () => { let data = DEFAULT_DATA; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no title and prefix", () => { const tree = shallow() expect(tree).toMatchSnapshot() }) }) describe("SubTitle Preview", () => { it("renders correctly", () => { let data = DEFAULT_DATA; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no subtitle", () => { const tree = shallow() expect(tree).toMatchSnapshot() }) }) describe("SectionTitle Preview", () => { it("renders correctly", () => { const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no label", () => { const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with visible false", () => { const tree = shallow() expect(tree).toMatchSnapshot() }) }) describe("DisplayWork Preview", () => { it("renders correctly", () => { let prefix = DEFAULT_PREFIX; let data = DEFAULT_DATA; let link = DEFAULT_LINK; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no prefix, link and project", () => { const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no prefix", () => { let data = DEFAULT_DATA; let link = DEFAULT_LINK; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no project", () => { let prefix = DEFAULT_PREFIX; let link = DEFAULT_LINK; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no link", () => { let prefix = DEFAULT_PREFIX; let data = DEFAULT_DATA; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no prefix and link", () => { let data = DEFAULT_DATA; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no project and link", () => { let prefix = DEFAULT_PREFIX; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no project and prefix", () => { let link = DEFAULT_LINK; const tree = shallow() expect(tree).toMatchSnapshot() }) }) describe("DisplaySocial Preview", () => { it("renders correctly", () => { let social = DEFAULT_SOCIAL; const tree = shallow( ) expect(tree).toMatchSnapshot() }) it("renders correctly with no username", () => { const tree = shallow( ) expect(tree).toMatchSnapshot() }) }) describe("VisitorsBadge Preview", () => { it("renders correctly", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow( ) expect(tree).toMatchSnapshot() }) it("renders correctly with show true", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow( ) expect(tree).toMatchSnapshot() }) }) describe("GithubProfileTrophy Preview", () => { it("renders correctly", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with show true", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow() expect(tree).toMatchSnapshot() }) }) describe("TwitterBadgePreview Preview", () => { it("renders correctly", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with show true", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow() 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 = shallow() expect(tree).toMatchSnapshot() }) }) describe("Social Preview", () => { it("renders correctly", () => { let social = DEFAULT_SOCIAL; const tree = shallow() expect(tree).toMatchSnapshot() }) }) describe("Skills Preview", () => { it("renders correctly", () => { let skills = DUMMY_SKILLS.skills const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with no skills", () => { let skills = {} const tree = shallow() expect(tree).toMatchSnapshot() }) }) describe("TopLanguages Preview", () => { it("renders correctly", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly with show true", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow() expect(tree).toMatchSnapshot() }) }) describe("GitHubStats Preview", () => { it("renders correctly", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow() expect(tree).toMatchSnapshot() }) it("renders correctly", () => { let data = DEFAULT_DATA; let social = DEFAULT_SOCIAL; const tree = shallow() expect(tree).toMatchSnapshot() }) })