Skip to content

Commit

Permalink
Merge pull request #1217 from MetaPhase-Consulting/chore/increase-tes…
Browse files Browse the repository at this point in the history
…t-coverage

increasing test coverage
  • Loading branch information
elizabeth-jimenez committed Nov 16, 2020
2 parents 8a4cd4b + 6676410 commit 83a97db
Show file tree
Hide file tree
Showing 15 changed files with 359 additions and 12 deletions.
31 changes: 30 additions & 1 deletion src/Components/BidCount/BidCount.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ describe('BidCountComponent', () => {
in_grade_at_skill: 5,
},
};
const stylePropsTrue = {
altStyle: true,
isCondensed: true,
isTandemTwo: true,
};
const stylePropsFalse = {
altStyle: false,
isCondensed: false,
isTandemTwo: false,
};

it('is defined', () => {
const wrapper = shallow(
<BidCount {...props} />,
Expand All @@ -20,11 +31,29 @@ describe('BidCountComponent', () => {

it('is defined when hideLabel is true', () => {
const wrapper = shallow(
<BidCount {...props} />,
<BidCount {...props} hideLabel />,
);
expect(wrapper).toBeDefined();
});

it('properly renders classes on true', () => {
const wrapper = shallow(
<BidCount {...props} {...stylePropsTrue} />,
);
expect(wrapper.find('.bid-count-secondary').exists()).toBe(true);
expect(wrapper.find('.bid-count-condensed').exists()).toBe(true);
expect(wrapper.find('.bid-count-list-tandem').exists()).toBe(true);
});

it('properly renders classes on false', () => {
const wrapper = shallow(
<BidCount {...props} {...stylePropsFalse} />,
);
expect(wrapper.find('.bid-count-secondary').exists()).toBe(false);
expect(wrapper.find('.bid-count-condensed').exists()).toBe(false);
expect(wrapper.find('.bid-count-list-tandem').exists()).toBe(false);
});

it('displays 0 when a prop is not defined', () => {
const bidStatistics = {
total_bids: undefined,
Expand Down
34 changes: 33 additions & 1 deletion src/Components/BidListMessages/Success.test.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,42 @@
import { shallow } from 'enzyme';
import toJSON from 'enzyme-to-json';
import Success from './Success';
import detailsObject from '../../__mocks__/detailsObject';

describe('Success', () => {
const props = {
client: {
perdet_seq_number: 12345,
name: 'Woodard, Wendy',
},
hideLink: false,
};

it('is defined', () => {
const wrapper = shallow(<Success pos={detailsObject} />);
const wrapper = shallow(<Success pos={detailsObject} {...props} />);
expect(wrapper).toBeDefined();
expect(wrapper.find('Link')
.exists()).toBe(true);
});

it('hides link', () => {
const wrapper = shallow(<Success pos={detailsObject} {...props} hideLink />);
expect(wrapper.find('Link')
.exists()).toBe(false);
});

it('renders public profile link when given perdet', () => {
const wrapper = shallow(<Success pos={detailsObject} {...props} />);
expect(wrapper.find('Link').prop('to')).toBe('/profile/bidtracker/public/12345/');
});

it('renders basic link', () => {
const wrapper = shallow(<Success pos={detailsObject} />);
expect(wrapper.find('Link').prop('to')).toBe('/profile/bidtracker/');
});

it('matches snapshot', () => {
const wrapper = shallow(<Success pos={detailsObject} {...props} />);
expect(toJSON(wrapper)).toMatchSnapshot();
});
});
21 changes: 21 additions & 0 deletions src/Components/BidListMessages/__snapshots__/Success.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Success matches snapshot 1`] = `
<span>
Test Position
(
00003027
) has been successfully added to Bid List.
<span>
<Link
replace={false}
to="/profile/bidtracker/public/12345/"
>
Go to
Woodard, Wendy's'
Bid Tracker
</Link>
.
</span>
</span>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ exports[`BidTrackerCardContainerComponent matches snapshot when priorityExists i
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -149,6 +153,10 @@ exports[`BidTrackerCardContainerComponent matches snapshot when priorityExists i
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down Expand Up @@ -317,6 +325,10 @@ exports[`BidTrackerCardContainerComponent matches snapshot when priorityExists i
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -368,6 +380,10 @@ exports[`BidTrackerCardContainerComponent matches snapshot when priorityExists i
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ exports[`BidTrackerCardListComponent matches snapshot 1`] = `
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -150,6 +154,10 @@ exports[`BidTrackerCardListComponent matches snapshot 1`] = `
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down Expand Up @@ -245,6 +253,10 @@ exports[`BidTrackerCardListComponent matches snapshot 1`] = `
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -296,6 +308,10 @@ exports[`BidTrackerCardListComponent matches snapshot 1`] = `
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down Expand Up @@ -394,6 +410,10 @@ exports[`BidTrackerCardListComponent matches snapshot 1`] = `
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -445,6 +465,10 @@ exports[`BidTrackerCardListComponent matches snapshot 1`] = `
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ exports[`BidTrackerComponent matches snapshot 1`] = `
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -551,6 +555,10 @@ exports[`BidTrackerComponent matches snapshot 1`] = `
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ exports[`BidderPortfolioGridItemComponent matches snapshot 1`] = `
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -110,6 +114,10 @@ exports[`BidderPortfolioGridItemComponent matches snapshot 1`] = `
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down Expand Up @@ -145,6 +153,10 @@ exports[`BidderPortfolioGridItemComponent matches snapshot 1`] = `
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -196,6 +208,10 @@ exports[`BidderPortfolioGridItemComponent matches snapshot 1`] = `
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ exports[`DesktopNav matches snapshot when logged in 1`] = `
},
],
},
"employee_profile_url": Object {
"external": "https://external.com",
"internal": "https://internal.com",
},
"favorite_positions": Array [
Object {
"id": 1,
Expand Down Expand Up @@ -110,6 +114,10 @@ exports[`DesktopNav matches snapshot when logged in 1`] = `
"last_name": "Doe",
"username": "jdoe",
},
"user_info": Object {
"office_address": "1234 Apple St. NW Washington, DC 20010",
"office_phone": "202-876-5432",
},
}
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ exports[`UserProfileContactInformationComponent matches snapshot 1`] = `
/>
<InformationDataPoint
className=""
content="None listed"
content={
<a
href="tel:202-876-5432"
rel="nofollow"
>
202-876-5432
</a>
}
sideBySide={false}
title="Office number"
titleOnBottom={false}
Expand All @@ -45,7 +52,7 @@ exports[`UserProfileContactInformationComponent matches snapshot 1`] = `
</Connect(StaticDevContent)>
<InformationDataPoint
className=""
content="None listed"
content="1234 Apple St. NW Washington, DC 20010"
sideBySide={false}
title="Post/Office address"
titleOnBottom={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ UserProfileGeneralInformation.defaultProps = {
onToastSuccess: EMPTY_FUNCTION,
};

const mapDispatchToProps = dispatch => ({
export const mapDispatchToProps = dispatch => ({
onToastError: (id) => dispatch(toastError('We were unable to process your Employee Profile download. Please try again later.', 'An error has occurred', id, true)),
onToastInfo: (id) => dispatch(toastInfo('Please wait while we process your request.', 'Loading...', id)),
onToastSuccess: (id) => dispatch(toastSuccess('Employee profile succesfully downloaded.', 'Success', id, true)),
Expand Down
Loading

0 comments on commit 83a97db

Please sign in to comment.