Skip to content
This repository has been archived by the owner on Jul 9, 2019. It is now read-only.

Commit

Permalink
added a test
Browse files Browse the repository at this point in the history
  • Loading branch information
richarddubay committed Dec 1, 2016
1 parent e29c249 commit 3f68ccf
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
exports[`Year To Date should render with the default set of props 1`] = `
<div
className="card">
<div
className="card__item soft">
<div
className="soft-double-bottom soft-double-top">
<LineGraph
axisStyles={
Object {
"axis": Object {
"lineColor": "transparent",
"lineWidth": "0",
},
"tickLabels": Object {
"fill": "#858585",
"fontSize": "20",
"padding": "8",
},
}
}
data={
Array [
Object {
"amount": 300,
"month": "January",
"tick": "J",
},
Object {
"amount": 275,
"month": "February",
"tick": "F",
},
Object {
"amount": 300,
"month": "March",
"tick": "M",
},
Object {
"amount": 325,
"month": "April",
"tick": "A",
},
Object {
"amount": 300,
"month": "May",
"tick": "M",
},
Object {
"amount": 275,
"month": "June",
"tick": "J",
},
Object {
"amount": 300,
"month": "July",
"tick": "J",
},
Object {
"amount": 325,
"month": "August",
"tick": "A",
},
Object {
"amount": 300,
"month": "September",
"tick": "S",
},
Object {
"amount": 275,
"month": "October",
"tick": "O",
},
Object {
"amount": 300,
"month": "November",
"tick": "N",
},
Object {
"amount": 350,
"month": "December",
"tick": "D",
},
]
}
dotColor="#6BAC43"
dotSize="5"
lineColor="#6BAC43"
lineWidth="3" />
</div>
<div
className="floating text-left text-dark-primary">
<h4
className="floating__item flush"
style={
Object {
"paddingRight": "5px",
}
}>
$
</h4>
<h2
className="floating__item flush">
2017
</h2>
<h4
className="floating__item flush">
.
00
</h4>
</div>
<p
className="text-dark-primary italic text-left">
Contributed so far this year
</p>
<div
className="text-left">
<Link
className="text-left"
onlyActiveOnIndex={false}
style={Object {}}
to="https://my.newspring.cc">
<h6
className="display-inline-block">
View Your Giving History
</h6>
<span
className="icon-arrow-next soft-half-left" />
</Link>
</div>
</div>
</div>
`;
101 changes: 101 additions & 0 deletions imports/components/cards/__tests__/cards.YearToDate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { mount, shallow } from "enzyme";
import { mountToJson, shallowToJson } from "enzyme-to-json";
import YearToDate from "../cards.YearToDate";

describe("Year To Date", () => {

const generateComponent = (additionalProps = {}) => {
const defaultProps = {
graphData: {
data: [
{
month: "January",
amount: 300,
tick: "J",
},
{
month: "February",
amount: 275,
tick: "F",
},
{
month: "March",
amount: 300,
tick: "M",
},
{
month: "April",
amount: 325,
tick: "A",
},
{
month: "May",
amount: 300,
tick: "M",
},
{
month: "June",
amount: 275,
tick: "J",
},
{
month: "July",
amount: 300,
tick: "J",
},
{
month: "August",
amount: 325,
tick: "A",
},
{
month: "September",
amount: 300,
tick: "S",
},
{
month: "October",
amount: 275,
tick: "O",
},
{
month: "November",
amount: 300,
tick: "N",
},
{
month: "December",
amount: 350,
tick: "D",
},
],
lineColor: "#6BAC43",
lineWidth: "3",
dotColor: "#6BAC43",
dotSize: "5",
axisStyles: {
axis: {
lineColor: "transparent",
lineWidth: "0",
},
tickLabels: {
fontSize: "20",
padding: "8",
fill: "#858585",
},
},
},
amount: "2017",
linkUrl: "https://my.newspring.cc",
};

return (
<YearToDate {...defaultProps} {...additionalProps} />
);
};

it("should render with the default set of props", () => {
const component = shallow(generateComponent());
expect(shallowToJson(component)).toMatchSnapshot();
});
});

0 comments on commit 3f68ccf

Please sign in to comment.