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

Commit

Permalink
Tests updated to removed obsolete function tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edolyne committed Dec 11, 2016
1 parent 522d903 commit e39d97f
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,75 @@ exports[`ScheduleOverview doesn't have a latest transaction, if one isn't passed
</div>
`;

exports[`ScheduleOverview falls back correctly if a base heading size isn't set 1`] = `
<div
className="card">
<div
className="card__item soft push-half-ends one-whole">
<button
className="float-right h6 text-dark-tertiary outlined--bottom"
onClick={[Function]}
style={
Object {
"borderColor": "inherit",
"borderWidth": "2px",
}
}>
Edit
</button>
<div
className="floating text-left text-dark-primary">
<h4
className="floating__item flush"
style={
Object {
"paddingRight": "5px",
}
}>
$
</h4>
<h2
className="floating__item flush">
420
</h2>
<h4
className="floating__item flush">
.
00
</h4>
</div>
<div
className="floating text-left push-bottom">
<h5
className="floating__item soft-half-right flush text-dark-primary">
Step Up Fund
</h5>
<h6
className="floating__item flush text-dark-tertiary">
Once A Month
</h6>
</div>
<p
className="flush"
style={Object {}}>
<span
className="h7 text-dark-tertiary push-half-right"
style={
Object {
"verticalAlign": "middle",
}
}>
Started:
</span>
<em
className="text-dark-primary">
Jun 15, 2015
</em>
</p>
</div>
</div>
`;

exports[`ScheduleOverview falls back correctly if currency symbol isn't present. 1`] = `
<div
className="card">
Expand Down Expand Up @@ -263,7 +332,7 @@ exports[`ScheduleOverview falls back correctly if there isn't an amount. 1`] = `
</h4>
<h2
className="floating__item flush">
0
00
</h2>
<h4
className="floating__item flush">
Expand Down
59 changes: 21 additions & 38 deletions imports/components/cards/__tests__/cards.ScheduleOverview.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import renderer from "react-test-renderer";
import { reset } from "aphrodite/lib/inject";
import ScheduleOverview,
{ getCurrencySymbol,
getNegative,
getDollars,
getCents
} from "../cards.ScheduleOverview";
import ScheduleOverview from "../cards.ScheduleOverview";

describe("ScheduleOverview", () => {
beforeEach(() => {
Expand All @@ -16,42 +11,11 @@ describe("ScheduleOverview", () => {
reset();
});

it("returns a '$' currency symbol", () => {
expect(getCurrencySymbol("$420.00")).toBeDefined();
});

it("returns a '$' currency symbol when none is provided", () => {
expect(getCurrencySymbol("420.00")).toBe("$");
});

it("returns a negative when one is provided", () => {
expect(getNegative("$-420.00")).toBeDefined();
});

it("doesn't return a negative when one isn't provided", () => {
expect(getNegative("$420.00")).toBeNull();
});

it("returns '420' dollars", () => {
expect(getDollars("$420.00")).toBe("420");
});

it("returns '0' dollars when none is provided", () => {
expect(getDollars("")).toBe("0");
});

it("returns '12' cents", () => {
expect(getCents("$420.12")).toBe("12");
});

it("returns '00' cents when none is provided", () => {
expect(getCents("420")).toBe("00");
});

it("has an amount, fund, frequency, started, latest and onEditClick.", () => {
const tree = renderer.create(
<ScheduleOverview
amount="$420.00"
baseHeadingSize="2"
fund="Step Up Fund"
frequency="Once A Month"
started="Jun 15, 2015"
Expand All @@ -66,6 +30,7 @@ describe("ScheduleOverview", () => {
const tree = renderer.create(
<ScheduleOverview
amount="$-420.00"
baseHeadingSize="2"
fund="Step Up Fund"
frequency="Once A Month"
started="Jun 15, 2015"
Expand All @@ -80,6 +45,7 @@ describe("ScheduleOverview", () => {
const tree = renderer.create(
<ScheduleOverview
amount="$420.00"
baseHeadingSize="2"
fund="Step Up Fund"
frequency="Once A Month"
started="Jun 15, 2015"
Expand All @@ -94,6 +60,7 @@ describe("ScheduleOverview", () => {
const tree = renderer.create(
<ScheduleOverview
amount="420.00"
baseHeadingSize="2"
fund="Step Up Fund"
frequency="Once A Month"
started="Jun 15, 2015"
Expand All @@ -108,6 +75,7 @@ describe("ScheduleOverview", () => {
const tree = renderer.create(
<ScheduleOverview
amount="$420"
baseHeadingSize="2"
fund="Step Up Fund"
frequency="Once A Month"
started="Jun 15, 2015"
Expand All @@ -122,6 +90,21 @@ describe("ScheduleOverview", () => {
const tree = renderer.create(
<ScheduleOverview
amount=""
baseHeadingSize="2"
fund="Step Up Fund"
frequency="Once A Month"
started="Jun 15, 2015"
onEditClick={jest.fn()}
/>
)

expect(tree).toMatchSnapshot();
});

it("falls back correctly if a base heading size isn't set", () => {
const tree = renderer.create(
<ScheduleOverview
amount="$420.00"
fund="Step Up Fund"
frequency="Once A Month"
started="Jun 15, 2015"
Expand Down

0 comments on commit e39d97f

Please sign in to comment.