fix tests & update config
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Donate renders correctly 1`] = `
|
||||
Array [
|
||||
<Fragment>
|
||||
<div
|
||||
className="text-center text-4xl my-2"
|
||||
>
|
||||
@@ -12,7 +12,7 @@ Array [
|
||||
>
|
||||
🙏
|
||||
</span>
|
||||
</div>,
|
||||
</div>
|
||||
<div
|
||||
className="flex flex-col sm:flex-row items-start justify-between"
|
||||
>
|
||||
@@ -97,6 +97,6 @@ Array [
|
||||
Buy me a coffee
|
||||
</a>
|
||||
</div>
|
||||
</div>,
|
||||
]
|
||||
</div>
|
||||
</Fragment>
|
||||
`;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Footer component Matches the snapshot 1`] = `
|
||||
exports[`Footer component renders correctly 1`] = `
|
||||
<div
|
||||
className="bg-gray-100 p-4 flex flex-col justify-center items-center shadow-inner mt-2"
|
||||
>
|
||||
@@ -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"
|
||||
@@ -53,29 +53,44 @@ exports[`Footer component Matches the snapshot 1`] = `
|
||||
<div
|
||||
className="ml-2 sm:ml-0"
|
||||
>
|
||||
<a
|
||||
href="/addons"
|
||||
<mockConstructor
|
||||
activeStyle={
|
||||
Object {
|
||||
"color": "#002ead",
|
||||
}
|
||||
}
|
||||
to="/addons"
|
||||
>
|
||||
Addons
|
||||
</a>
|
||||
</mockConstructor>
|
||||
</div>
|
||||
<div
|
||||
className="ml-2 sm:ml-0"
|
||||
>
|
||||
<a
|
||||
href="/support"
|
||||
<mockConstructor
|
||||
activeStyle={
|
||||
Object {
|
||||
"color": "#002ead",
|
||||
}
|
||||
}
|
||||
to="/support"
|
||||
>
|
||||
Support
|
||||
</a>
|
||||
</mockConstructor>
|
||||
</div>
|
||||
<div
|
||||
className="ml-2 sm:ml-0"
|
||||
>
|
||||
<a
|
||||
href="/about"
|
||||
<mockConstructor
|
||||
activeStyle={
|
||||
Object {
|
||||
"color": "#002ead",
|
||||
}
|
||||
}
|
||||
to="/about"
|
||||
>
|
||||
About
|
||||
</a>
|
||||
</mockConstructor>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -110,7 +125,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 +136,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 +156,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"
|
||||
|
||||
@@ -4,8 +4,8 @@ exports[`Header renders correctly 1`] = `
|
||||
<div
|
||||
className="shadow flex items-center justify-center flex-col mb-2 py-2"
|
||||
>
|
||||
<a
|
||||
href="/"
|
||||
<mockConstructor
|
||||
to="/"
|
||||
>
|
||||
<h1
|
||||
className="text-base font-bold font-title sm:text-2xl font-medium text-blue-800 flex justify-center items-center flex-col"
|
||||
@@ -19,7 +19,7 @@ exports[`Header renders correctly 1`] = `
|
||||
heading
|
||||
</div>
|
||||
</h1>
|
||||
</a>
|
||||
</mockConstructor>
|
||||
<div
|
||||
className="flex justify-center items-center"
|
||||
>
|
||||
@@ -32,26 +32,11 @@ exports[`Header renders correctly 1`] = `
|
||||
<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"
|
||||
<StarIcon
|
||||
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}
|
||||
id="star-icon"
|
||||
size={16}
|
||||
verticalAlign="text-bottom"
|
||||
/>
|
||||
Star this repo
|
||||
<span
|
||||
@@ -69,26 +54,11 @@ exports[`Header renders correctly 1`] = `
|
||||
<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"
|
||||
<RepoForkedIcon
|
||||
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}
|
||||
id="fork-icon"
|
||||
size={16}
|
||||
verticalAlign="text-bottom"
|
||||
/>
|
||||
Fork on GitHub
|
||||
<span
|
||||
|
||||
@@ -13,7 +13,7 @@ exports[`Subtitle renders correctly 1`] = `
|
||||
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"
|
||||
value="A frontend developer"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import React from "react"
|
||||
import renderer from "react-test-renderer"
|
||||
import toJson from "enzyme-to-json"
|
||||
import { shallow } from "enzyme"
|
||||
|
||||
import Donate from "../donate"
|
||||
|
||||
describe("Donate", () => {
|
||||
it("renders correctly", () => {
|
||||
const tree = renderer
|
||||
.create(<Donate />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
const component = shallow(<Donate />)
|
||||
expect(toJson(component)).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import React from "react"
|
||||
import renderer from "react-test-renderer"
|
||||
import { shallow } from "enzyme"
|
||||
import toJson from "enzyme-to-json"
|
||||
|
||||
import Footer from "../footer"
|
||||
|
||||
describe("Footer component", () => {
|
||||
test("Matches the snapshot", () => {
|
||||
const footer = renderer.create(<Footer />).toJSON();
|
||||
expect(footer).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
const component = shallow(<Footer />)
|
||||
|
||||
it("renders correctly", () => {
|
||||
expect(toJson(component)).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import React from "react"
|
||||
import renderer from "react-test-renderer"
|
||||
import { shallow } from "enzyme"
|
||||
import toJson from "enzyme-to-json"
|
||||
|
||||
import Header from "../header"
|
||||
|
||||
describe("Header", () => {
|
||||
const component = shallow(<Header heading="heading" />)
|
||||
|
||||
it("renders correctly", () => {
|
||||
const tree = renderer
|
||||
.create(<Header heading="heading" />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
expect(toJson(component)).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import React from "react"
|
||||
import renderer from "react-test-renderer"
|
||||
import { shallow } from "enzyme"
|
||||
import toJson from "enzyme-to-json"
|
||||
|
||||
import Loader from "../loader"
|
||||
|
||||
describe("Loader", () => {
|
||||
const component = shallow(<Loader />)
|
||||
|
||||
it("renders correctly", () => {
|
||||
const tree = renderer.create(<Loader />).toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
expect(toJson(component)).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import React from "react"
|
||||
import renderer from "react-test-renderer"
|
||||
import { shallow } from "enzyme"
|
||||
import toJson from "enzyme-to-json"
|
||||
|
||||
import Subtitle from "../subtitle"
|
||||
|
||||
describe("Subtitle", () => {
|
||||
const component = shallow(
|
||||
<Subtitle data={{ subtitle: "A frontend developer" }} />
|
||||
)
|
||||
|
||||
it("renders correctly", () => {
|
||||
const tree = renderer
|
||||
.create(<Subtitle data={{ subtitle: "A passionate frontend developer from India" }} />)
|
||||
.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
expect(toJson(component)).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import toJson from "enzyme-to-json"
|
||||
|
||||
import Title from "../title"
|
||||
import {configure, shallow} from "enzyme";
|
||||
import toJson from "enzyme-to-json";
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
describe("Title", () => {
|
||||
const mockEvent = { target: { value: "This is a mock event" } },
|
||||
props = {
|
||||
const mockEvent = { target: { value: "This is a mock event" } }
|
||||
const props = {
|
||||
prefix: {
|
||||
title: "test_title",
|
||||
currentWork: "test_currentwork"
|
||||
currentWork: "test_currentwork",
|
||||
},
|
||||
data: {title: "test_data"},
|
||||
link: {currentWork: "test_currentwork"},
|
||||
data: { title: "test_data" },
|
||||
link: { currentWork: "test_currentwork" },
|
||||
handlePrefixChange: jest.fn().mockReturnValue({}),
|
||||
handleLinkChange: jest.fn().mockReturnValue({}),
|
||||
handleDataChange: jest.fn().mockReturnValue({}),
|
||||
};
|
||||
}
|
||||
|
||||
it("renders title component correctly", () => {
|
||||
const component = shallow(<Title {...props}/>);
|
||||
component.find('input').at(0).simulate('change', mockEvent);
|
||||
component.find('input').at(1).simulate('change', mockEvent);
|
||||
expect(toJson(component)).toMatchSnapshot();
|
||||
});
|
||||
const component = shallow(<Title {...props} />)
|
||||
component.find("input").at(0).simulate("change", mockEvent)
|
||||
component.find("input").at(1).simulate("change", mockEvent)
|
||||
expect(toJson(component)).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,32 +1,28 @@
|
||||
import React from "react";
|
||||
import { shallow, configure } from 'enzyme';
|
||||
import toJson from 'enzyme-to-json';
|
||||
import Adapter from 'enzyme-adapter-react-16';
|
||||
import React from "react"
|
||||
import { shallow } from "enzyme"
|
||||
import toJson from "enzyme-to-json"
|
||||
|
||||
import Work from "../work"
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
describe("Work", () => {
|
||||
const props = {
|
||||
prefix: {
|
||||
title: "test_title",
|
||||
currentWork: "test_currentwork"
|
||||
},
|
||||
data: {title: "test_data"},
|
||||
link: {currentWork: "test_currentwork"},
|
||||
handlePrefixChange: jest.fn().mockReturnValue({}),
|
||||
handleLinkChange: jest.fn().mockReturnValue({}),
|
||||
handleDataChange: jest.fn().mockReturnValue({}),
|
||||
},
|
||||
mockEvent = { target: { value: "This is a mock event" } };
|
||||
const mockEvent = { target: { value: "This is a mock event" } }
|
||||
const props = {
|
||||
prefix: {
|
||||
title: "test_title",
|
||||
currentWork: "test_currentwork",
|
||||
},
|
||||
data: { title: "test_data" },
|
||||
link: { currentWork: "test_currentwork" },
|
||||
handlePrefixChange: jest.fn().mockReturnValue({}),
|
||||
handleLinkChange: jest.fn().mockReturnValue({}),
|
||||
handleDataChange: jest.fn().mockReturnValue({}),
|
||||
}
|
||||
|
||||
it("renders work component correctly", () => {
|
||||
let i;
|
||||
const component = shallow(<Work {...props}/>);
|
||||
for (i = 0; i < component.find('input').length; i++) {
|
||||
component.find('input').at(i).simulate('change', mockEvent);
|
||||
}
|
||||
expect(toJson(component)).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
it("renders work component correctly", () => {
|
||||
const component = shallow(<Work {...props} />)
|
||||
for (let i = 0; i < component.find("input").length; i++) {
|
||||
component.find("input").at(i).simulate("change", mockEvent)
|
||||
}
|
||||
expect(toJson(component)).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user