This repository has been archived by the owner on Jul 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* SYS-2631 Testing the right panel * SYS-2631 testing the home directory * SYS-2631 testing AddSavedPayment * rebased and fixed tests
- Loading branch information
Showing
16 changed files
with
1,724 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(() => <div id="YTDMetrics" />)); | ||
|
||
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) => | ||
<RightPanel | ||
{...additionalProps} | ||
data={mockData} | ||
changeYear={() => 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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.