diff --git a/imports/pages/give/home/Layout.js b/imports/pages/give/home/Layout.js
index 61daf9ae1..244bbff09 100644
--- a/imports/pages/give/home/Layout.js
+++ b/imports/pages/give/home/Layout.js
@@ -6,7 +6,7 @@ import Activity from "./Activity";
import Schedules from "./Schedules";
import SavedPayments from "./SavedPayments";
-const ACTIVITY_QUERY = gql`
+export const ACTIVITY_QUERY = gql`
query GivingDashboard($filters: [String]!) {
scheduledTransactions(cache: false) {
id
diff --git a/imports/pages/give/home/RightPanel.js b/imports/pages/give/home/RightPanel.js
index 9666f2c5e..170da97ee 100644
--- a/imports/pages/give/home/RightPanel.js
+++ b/imports/pages/give/home/RightPanel.js
@@ -1,5 +1,5 @@
-// flow
+// @flow
import moment from "moment";
@@ -12,16 +12,21 @@ import withData from "./givingSummaryEnhancer";
import YTDGraph from "./YTDMetrics";
import Progress from "./FundBreakdown";
-const start = moment().year();
+export const start = moment().year();
-const YEARS = [{ value: start, label: start }];
+export const YEARS = [{ value: start, label: start }];
for (const i of Array(9).keys()) {
YEARS.push({ value: start - (i + 1), label: start - (i + 1) });
}
+type IRightPanel = {
+ loading: boolean,
+ data: Object,
+ changeYear: Function,
+};
-export default withData(({ loading, data, changeYear }) => (
+export const RightPanel = ({ loading, data, changeYear }: IRightPanel) => (
{/* spacer */}
@@ -69,5 +74,6 @@ export default withData(({ loading, data, changeYear }) => (
)}
-));
+);
+export default withData(RightPanel);
diff --git a/imports/pages/give/home/__tests__/GivingSummary.js b/imports/pages/give/home/__tests__/GivingSummary.js
index 0c1f49dca..f2a498909 100644
--- a/imports/pages/give/home/__tests__/GivingSummary.js
+++ b/imports/pages/give/home/__tests__/GivingSummary.js
@@ -1,7 +1,7 @@
import { GivingSummary, Display } from "../GivingSummary";
-import { mount } from "enzyme";
-import { mountToJson } from "enzyme-to-json";
+import { shallow, mount } from "enzyme";
+import { shallowToJson, mountToJson } from "enzyme-to-json";
//mocked because already tested
jest.mock("./../../../../components/cards/cards.YearToDate.js", () => () =>
);
@@ -38,8 +38,12 @@ describe("GivingSummary", () => {
expect(mountToJson(component)).toMatchSnapshot();
});
it("should render nothing if the breakpoints don't match", () => {
- const component = mount( );
- expect(mountToJson(component)).toMatchSnapshot();
+ const component = shallow( );
+ expect(shallowToJson(component)).toMatchSnapshot();
+ });
+ it("should render if the breakpoints don't match", () => {
+ const component = shallow( );
+ expect(shallowToJson(component)).toMatchSnapshot();
});
it("should pass correct props to graph with data", () => {
const component = mount(generateComponent({data: data}));
diff --git a/imports/pages/give/home/__tests__/Layout.js b/imports/pages/give/home/__tests__/Layout.js
new file mode 100644
index 000000000..e2d42be2f
--- /dev/null
+++ b/imports/pages/give/home/__tests__/Layout.js
@@ -0,0 +1,11 @@
+
+import { ACTIVITY_QUERY } from "../Layout";
+import { mount } from "enzyme";
+import { mountToJson } from "enzyme-to-json";
+
+describe("giving homepage layout", () => {
+
+ it("should have a consistent data shape", () => {
+ expect(ACTIVITY_QUERY).toMatchSnapshot();
+ });
+});
\ No newline at end of file
diff --git a/imports/pages/give/home/__tests__/RightPanel.js b/imports/pages/give/home/__tests__/RightPanel.js
new file mode 100644
index 000000000..15d9d9013
--- /dev/null
+++ b/imports/pages/give/home/__tests__/RightPanel.js
@@ -0,0 +1,67 @@
+import { mount } from "enzyme";
+import { mountToJson } from "enzyme-to-json";
+import { reset, startBuffering } from "aphrodite/lib/inject";
+
+import { RightPanel, start, YEARS } from "../RightPanel";
+
+jest.mock("../YTDMetrics", () => jest.fn(() =>
));
+
+const mockData = {
+ accounts: {
+ 'General Fund': 66,
+ 'Christmas Offering': 0,
+ 'Step Up Fund': 0
+ },
+ total: 66,
+ chartData: [
+ { month: 'January', amount: 0, tick: 'J' },
+ { month: 'February', amount: 11, tick: 'F' },
+ { month: 'March', amount: 0, tick: 'M' },
+ { month: 'April', amount: 9, tick: 'A' },
+ { month: 'May', amount: 18, tick: 'M' },
+ { month: 'June', amount: 7, tick: 'J' },
+ { month: 'July', amount: 6, tick: 'J' },
+ { month: 'August', amount: 5, tick: 'A' },
+ { month: 'September', amount: 4, tick: 'S' },
+ { month: 'October', amount: 3, tick: 'O' },
+ { month: 'November', amount: 2, tick: 'N' },
+ { month: 'December', amount: 1, tick: 'D' }
+ ]
+};
+
+describe("RightPanel Layout", () => {
+
+ beforeEach(() => {
+ reset();
+ startBuffering();
+ });
+
+ afterEach(() => {
+ reset();
+ });
+
+ const generateComponent = (additionalProps) =>
+ jest.fn()}
+ />;
+
+ it("should be the current year", () => {
+ expect(start).toBe(new Date().getFullYear())
+ });
+
+ it("should provide an array of 10 years", () => {
+ expect(YEARS.length).toBe(10);
+ });
+
+ it("should render a loading state", () => {
+ const tree = mount(generateComponent({ loading: true }));
+ expect(mountToJson(tree)).toMatchSnapshot();
+ });
+
+ it("should render with data", () => {
+ const tree = mount(generateComponent({ loading: false }));
+ expect(mountToJson(tree)).toMatchSnapshot();
+ });
+});
\ No newline at end of file
diff --git a/imports/pages/give/home/__tests__/SavedPayments.js b/imports/pages/give/home/__tests__/SavedPayments.js
index 2529ea0b2..06e7a1061 100644
--- a/imports/pages/give/home/__tests__/SavedPayments.js
+++ b/imports/pages/give/home/__tests__/SavedPayments.js
@@ -29,6 +29,22 @@ describe ("Saved Payments List", () => {
expect(mountToJson(component)).toMatchSnapshot();
});
+ it ("should render a loading state", () => {
+ const mockLoadingData = {
+ loading: true,
+ };
+
+ const component = mount( );
+ expect(mountToJson(component)).toMatchSnapshot();
+ });
+
+ it("should render without saved payments", () => {
+ const mockEmptyData = { };
+
+ const component = mount( );
+ expect(mountToJson(component)).toMatchSnapshot();
+ });
+
it ("should render properly with data", () => {
const component = mount(generateComponent());
expect(mountToJson(component)).toMatchSnapshot();
diff --git a/imports/pages/give/home/__tests__/__snapshots__/GivingSummary.js.snap b/imports/pages/give/home/__tests__/__snapshots__/GivingSummary.js.snap
index 9e01fa9e5..9feec60c5 100644
--- a/imports/pages/give/home/__tests__/__snapshots__/GivingSummary.js.snap
+++ b/imports/pages/give/home/__tests__/__snapshots__/GivingSummary.js.snap
@@ -161,13 +161,8 @@ exports[`GivingSummary should pass correct props to graph with data 1`] = `
`;
-exports[`GivingSummary should render nothing if the breakpoints don't match 1`] = `
-
-`;
+exports[`GivingSummary should render if the breakpoints don't match 1`] = ` `;
+
+exports[`GivingSummary should render nothing if the breakpoints don't match 1`] = `null`;
exports[`GivingSummary should render with minimal props 1`] = ` `;
diff --git a/imports/pages/give/home/__tests__/__snapshots__/Layout.js.snap b/imports/pages/give/home/__tests__/__snapshots__/Layout.js.snap
new file mode 100644
index 000000000..fa94bdf28
--- /dev/null
+++ b/imports/pages/give/home/__tests__/__snapshots__/Layout.js.snap
@@ -0,0 +1,575 @@
+exports[`giving homepage layout should have a consistent data shape 1`] = `
+Object {
+ "definitions": Array [
+ Object {
+ "directives": Array [],
+ "kind": "OperationDefinition",
+ "name": Object {
+ "kind": "Name",
+ "value": "GivingDashboard",
+ },
+ "operation": "query",
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [
+ Object {
+ "kind": "Argument",
+ "name": Object {
+ "kind": "Name",
+ "value": "cache",
+ },
+ "value": Object {
+ "kind": "BooleanValue",
+ "value": false,
+ },
+ },
+ ],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "scheduledTransactions",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "id",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "start",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "details",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "account",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "name",
+ },
+ "selectionSet": null,
+ },
+ ],
+ },
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "amount",
+ },
+ "selectionSet": null,
+ },
+ ],
+ },
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "transactions",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "date",
+ },
+ "selectionSet": null,
+ },
+ ],
+ },
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "schedule",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "description",
+ },
+ "selectionSet": null,
+ },
+ ],
+ },
+ },
+ ],
+ },
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [
+ Object {
+ "kind": "Argument",
+ "name": Object {
+ "kind": "Name",
+ "value": "cache",
+ },
+ "value": Object {
+ "kind": "BooleanValue",
+ "value": false,
+ },
+ },
+ ],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "savedPayments",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": Object {
+ "kind": "Name",
+ "value": "id",
+ },
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "entityId",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "name",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "payment",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "accountNumber",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "paymentType",
+ },
+ "selectionSet": null,
+ },
+ ],
+ },
+ },
+ ],
+ },
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [
+ Object {
+ "kind": "Argument",
+ "name": Object {
+ "kind": "Name",
+ "value": "filters",
+ },
+ "value": Object {
+ "kind": "Variable",
+ "name": Object {
+ "kind": "Name",
+ "value": "filters",
+ },
+ },
+ },
+ ],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "userFeed",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "directives": Array [],
+ "kind": "InlineFragment",
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "id",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "date",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "summary",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "status",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "statusMessage",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "schedule",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "id",
+ },
+ "selectionSet": null,
+ },
+ ],
+ },
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "details",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "amount",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "account",
+ },
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "name",
+ },
+ "selectionSet": null,
+ },
+ ],
+ },
+ },
+ ],
+ },
+ },
+ ],
+ },
+ "typeCondition": Object {
+ "kind": "NamedType",
+ "name": Object {
+ "kind": "Name",
+ "value": "Transaction",
+ },
+ },
+ },
+ Object {
+ "directives": Array [],
+ "kind": "InlineFragment",
+ "selectionSet": Object {
+ "kind": "SelectionSet",
+ "selections": Array [
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "name",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "expirationYear",
+ },
+ "selectionSet": null,
+ },
+ Object {
+ "alias": null,
+ "arguments": Array [],
+ "directives": Array [],
+ "kind": "Field",
+ "name": Object {
+ "kind": "Name",
+ "value": "expirationMonth",
+ },
+ "selectionSet": null,
+ },
+ ],
+ },
+ "typeCondition": Object {
+ "kind": "NamedType",
+ "name": Object {
+ "kind": "Name",
+ "value": "SavedPayment",
+ },
+ },
+ },
+ ],
+ },
+ },
+ ],
+ },
+ "variableDefinitions": Array [
+ Object {
+ "defaultValue": null,
+ "kind": "VariableDefinition",
+ "type": Object {
+ "kind": "NonNullType",
+ "type": Object {
+ "kind": "ListType",
+ "type": Object {
+ "kind": "NamedType",
+ "name": Object {
+ "kind": "Name",
+ "value": "String",
+ },
+ },
+ },
+ },
+ "variable": Object {
+ "kind": "Variable",
+ "name": Object {
+ "kind": "Name",
+ "value": "filters",
+ },
+ },
+ },
+ ],
+ },
+ ],
+ "kind": "Document",
+ "loc": Object {
+ "end": 809,
+ "source": Source {
+ "body": "
+ query GivingDashboard($filters: [String]!) {
+ scheduledTransactions(cache: false) {
+ id
+ start
+ details {
+ account {
+ name
+ }
+ amount
+ }
+ transactions {
+ date
+ }
+ schedule {
+ description
+ }
+ }
+ savedPayments(cache: false){
+ id: entityId
+ name
+ payment {
+ accountNumber
+ paymentType
+ }
+ }
+ userFeed(filters: $filters) {
+ ... on Transaction {
+ id
+ date
+ summary
+ status
+ statusMessage
+ schedule {
+ id
+ }
+ details {
+ amount
+ account {
+ name
+ }
+ }
+ }
+ ... on SavedPayment {
+ name
+ expirationYear
+ expirationMonth
+ }
+ }
+ }
+",
+ "name": "GraphQL",
+ },
+ "start": 3,
+ },
+}
+`;
diff --git a/imports/pages/give/home/__tests__/__snapshots__/RightPanel.js.snap b/imports/pages/give/home/__tests__/__snapshots__/RightPanel.js.snap
new file mode 100644
index 000000000..28687de70
--- /dev/null
+++ b/imports/pages/give/home/__tests__/__snapshots__/RightPanel.js.snap
@@ -0,0 +1,690 @@
+exports[`RightPanel Layout should render a loading state 1`] = `
+
+
+
+
+ Year In Review
+
+
+
+
+
+ See your summary from
+
+
+
+
+
+
+
+
+ 2016
+
+
+ 2015
+
+
+ 2014
+
+
+ 2013
+
+
+ 2012
+
+
+ 2011
+
+
+ 2010
+
+
+ 2009
+
+
+ 2008
+
+
+ 2007
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`RightPanel Layout should render with data 1`] = `
+
+
+
+
+ Year In Review
+
+
+
+
+
+ See your summary from
+
+
+
+
+
+
+
+
+ 2016
+
+
+ 2015
+
+
+ 2014
+
+
+ 2013
+
+
+ 2012
+
+
+ 2011
+
+
+ 2010
+
+
+ 2009
+
+
+ 2008
+
+
+ 2007
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fund Breakdown
+
+
+
+
+
+
+ General Fund
+
+
+
+
+
+
+ $
+
+
+ 66
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
diff --git a/imports/pages/give/home/__tests__/__snapshots__/SavedPayments.js.snap b/imports/pages/give/home/__tests__/__snapshots__/SavedPayments.js.snap
index 09b89550a..fe80ec144 100644
--- a/imports/pages/give/home/__tests__/__snapshots__/SavedPayments.js.snap
+++ b/imports/pages/give/home/__tests__/__snapshots__/SavedPayments.js.snap
@@ -1,3 +1,32 @@
+exports[`Saved Payments List should render a loading state 1`] = `
+
+
+
+`;
+
exports[`Saved Payments List should render properly with data 1`] = `
`;
+
+exports[`Saved Payments List should render without saved payments 1`] = `
+
+
+
}
+ title="Saved Accounts">
+
+
+
+ Saved Accounts
+
+
+
+
+
+
+ Add Account
+
+
+
+
+
+
+
+
+
+ Adding a saved account makes giving even easier!
+
+
+ We can’t wait for you to take your next step in giving. After you have given your first contribution, you’ll see your activity here.
+
+
+ Get Started Now
+
+
+
+
+
+`;
diff --git a/imports/pages/give/home/__tests__/__snapshots__/index.js.snap b/imports/pages/give/home/__tests__/__snapshots__/index.js.snap
new file mode 100644
index 000000000..be60431dd
--- /dev/null
+++ b/imports/pages/give/home/__tests__/__snapshots__/index.js.snap
@@ -0,0 +1,15 @@
+exports[`home index file has a template 1`] = `
+
+
+
+`;
+
+exports[`home index file has routes 1`] = `
+Array [
+ Object {
+ "component": [Function],
+ "path": "home",
+ "rightComponent": ,
+ },
+]
+`;
diff --git a/imports/pages/give/home/__tests__/index.js b/imports/pages/give/home/__tests__/index.js
new file mode 100644
index 000000000..e012931b3
--- /dev/null
+++ b/imports/pages/give/home/__tests__/index.js
@@ -0,0 +1,15 @@
+
+import { shallow } from "enzyme";
+import { shallowToJson } from "enzyme-to-json"
+import Home from "../";
+
+describe("home index file", () => {
+ it("has a template", () => {
+ const wrapper = shallow( );
+ expect(shallowToJson(wrapper)).toMatchSnapshot();
+ });
+
+ it("has routes", () => {
+ expect(Home.Routes).toMatchSnapshot();
+ });
+})
\ No newline at end of file
diff --git a/imports/pages/give/home/components/__tests__/Loading.js b/imports/pages/give/home/components/__tests__/Loading.js
new file mode 100644
index 000000000..f01c40b20
--- /dev/null
+++ b/imports/pages/give/home/components/__tests__/Loading.js
@@ -0,0 +1,27 @@
+import { shallow } from "enzyme";
+import { shallowToJson } from "enzyme-to-json";
+import Loading from "../Loading";
+
+describe("Loading", () => {
+ const defaultProps = {
+ type: "update"
+ };
+
+ const generateComponent = (additionalProps = {}) => {
+ const newProps = {
+ ...defaultProps,
+ ...additionalProps,
+ };
+ return
+ };
+
+ it("renders with default props", () => {
+ const wrapper = shallow(generateComponent());
+ expect(shallowToJson(wrapper)).toMatchSnapshot();
+ });
+
+ it("renders with a different type", () => {
+ const wrapper = shallow(generateComponent({ type: "ohheckno" }));
+ expect(shallowToJson(wrapper)).toMatchSnapshot();
+ });
+})
\ No newline at end of file
diff --git a/imports/pages/give/home/components/__tests__/Success.js b/imports/pages/give/home/components/__tests__/Success.js
new file mode 100644
index 000000000..3779e69e3
--- /dev/null
+++ b/imports/pages/give/home/components/__tests__/Success.js
@@ -0,0 +1,61 @@
+import { shallow } from "enzyme";
+import { shallowToJson } from "enzyme-to-json";
+import Success, { ContactLink, ContactUs } from "../Success";
+
+describe("Success", () => {
+ const defaultProps = {
+ type: "update",
+ onClick: jest.fn(),
+ };
+
+ const generateComponent = (additionalProps = {}) => {
+ const newProps = {
+ ...defaultProps,
+ ...additionalProps,
+ };
+ return
+ };
+
+ it("renders with default props", () => {
+ const wrapper = shallow(generateComponent());
+ expect(shallowToJson(wrapper)).toMatchSnapshot();
+ });
+
+ it("renders with a different type", () => {
+ const wrapper = shallow(generateComponent({ type: "ohheckno" }));
+ expect(shallowToJson(wrapper)).toMatchSnapshot();
+ });
+
+ it("calls onClick when you click", () => {
+ const mockOnClick = jest.fn();
+ const wrapper = shallow(generateComponent({
+ onClick: mockOnClick,
+ }));
+
+ expect(mockOnClick).not.toHaveBeenCalled();
+ wrapper.find("button").simulate("click");
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
+ });
+});
+
+describe("ContactLink", () => {
+ const generateComponent = () => (
+
+ );
+
+ it("renders", () => {
+ const wrapper = shallow(generateComponent());
+ expect(shallowToJson(wrapper)).toMatchSnapshot();
+ })
+});
+
+describe("ContactUs", () => {
+ const generateComponent = () => (
+
+ );
+
+ it("renders", () => {
+ const wrapper = shallow(generateComponent());
+ expect(shallowToJson(wrapper)).toMatchSnapshot();
+ })
+})
\ No newline at end of file
diff --git a/imports/pages/give/home/components/__tests__/__snapshots__/Loading.js.snap b/imports/pages/give/home/components/__tests__/__snapshots__/Loading.js.snap
new file mode 100644
index 000000000..9818e1cb2
--- /dev/null
+++ b/imports/pages/give/home/components/__tests__/__snapshots__/Loading.js.snap
@@ -0,0 +1,61 @@
+exports[`Loading renders with a different type 1`] = `
+
+
+
+
+
+ We\'re Removing Your Saved Account
+
+
+ Please don\'t close this window while we remove your account details
+
+
+
+
+`;
+
+exports[`Loading renders with default props 1`] = `
+
+
+
+
+
+ We\'re Updating Your Saved Account
+
+
+ Please don\'t close this window while we update your account details
+
+
+
+
+`;
diff --git a/imports/pages/give/home/components/__tests__/__snapshots__/Success.js.snap b/imports/pages/give/home/components/__tests__/__snapshots__/Success.js.snap
new file mode 100644
index 000000000..3112e2b31
--- /dev/null
+++ b/imports/pages/give/home/components/__tests__/__snapshots__/Success.js.snap
@@ -0,0 +1,73 @@
+exports[`ContactLink renders 1`] = `
+
+ contact us
+
+`;
+
+exports[`ContactUs renders 1`] = `
+
+
+ If you have any questions please call our Finance Team at 864-965-9990 or
+
+
+
+ and someone will be happy to assist you.
+
+
+`;
+
+exports[`Success renders with a different type 1`] = `
+
+
+
+
+ Success!
+
+
+ Your account has been removed!
+
+
+ Back To Dashboard
+
+
+
+
+`;
+
+exports[`Success renders with default props 1`] = `
+
+
+
+
+ Success!
+
+
+ Thank you for updating your saved account!
+
+
+ Back To Dashboard
+
+
+
+
+`;