Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/tests client badge list #787

Merged
merged 6 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CheckboxList = ({ list, clientClassifications }) => (
const checked = indexOf(clientClassifications, c.code) > -1;
return (
<CheckBox
id={c.id}
id={c.code}
label={c.text}
small
value={checked}
Expand Down
81 changes: 79 additions & 2 deletions src/Components/BidderPortfolio/CheckboxList/CheckboxList.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,86 @@ import CheckboxList from './CheckboxList';

describe('CheckboxList', () => {
const props = {
id: 'a',
isDisabled: false,
clientClassifications: ['3', 'T', 'C'],
list: [
{
code: '3',
text: '3rd Tour Bidders',
disabled_ind: false,
},
{
code: '4',
text: 'Tenured',
disabled_ind: false,
},
{
code: 'D',
text: 'Differential Bidder',
disabled_ind: false,
},
{
code: 'T',
text: 'Tandem Bidder',
disabled_ind: false,
},
{
code: 'M',
text: 'Meritorious Step Increases',
disabled_ind: false,
},
{
code: '6',
text: '6/8 Rule',
disabled_ind: false,
},
{
code: 'F',
text: 'Fair Share Bidders',
disabled_ind: false,
},
{
code: 'C',
text: 'Critical Need Language',
disabled_ind: false,
},
{
code: 'C1',
text: 'Critical Need Language 1st Tour Complete',
disabled_ind: false,
},
{
code: 'CC',
text: 'Critical Need Language Final Tour Complete',
disabled_ind: false,
},
{
code: 'R',
text: 'Recommended for Tenure',
disabled_ind: false,
},
{
code: 'A',
text: 'Ambassador or Deputy Assistant Secretary',
disabled_ind: false,
},
{
code: 'F1',
text: 'Pickering Fellows',
disabled_ind: false,
},
{
code: 'F2',
text: 'Rangel Fellows',
disabled_ind: false,
},
{
code: 'P',
text: 'Pickering/Rangel Fellows',
disabled_ind: false,
},
],
};

it('is defined', () => {
const wrapper = shallow(<CheckboxList
{...props}
Expand Down
6 changes: 3 additions & 3 deletions src/Components/BidderPortfolio/ClientBadge/ClientBadge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ const ClientBadge = ({ type, status }) => {

ClientBadge.propTypes = {
type: PropTypes.oneOf([
3,
4,
'3',
'4',
'R',
6,
'6',
'A',
'C',
'C1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import ClientBadge from './ClientBadge';

describe('ClientBadge', () => {
const props = {
type: 3,
type: '3',
status: true,
};

it('is defined', () => {
const wrapper = shallow(<ClientBadge
{...props}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,86 @@ import ClientBadgeList from './ClientBadgeList';

describe('ClientBadgeList', () => {
const props = {
statuses: {
handshake: 0,
sixeight: 1,
fairshare: 2,
retirement: 1,
},
clientClassifications: ['3', 'T', 'C'],
classifications: [
{
code: '3',
text: '3rd Tour Bidders',
disabled_ind: false,
},
{
code: '4',
text: 'Tenured',
disabled_ind: false,
},
{
code: 'D',
text: 'Differential Bidder',
disabled_ind: true,
},
{
code: 'T',
text: 'Tandem Bidder',
disabled_ind: false,
},
{
code: 'M',
text: 'Meritorious Step Increases',
disabled_ind: false,
},
{
code: '6',
text: '6/8 Rule',
disabled_ind: false,
},
{
code: 'F',
text: 'Fair Share Bidders',
disabled_ind: false,
},
{
code: 'C',
text: 'Critical Need Language',
disabled_ind: false,
},
{
code: 'C1',
text: 'Critical Need Language 1st Tour Complete',
disabled_ind: false,
},
{
code: 'CC',
text: 'Critical Need Language Final Tour Complete',
disabled_ind: false,
},
{
code: 'R',
text: 'Recommended for Tenure',
disabled_ind: false,
},
{
code: 'A',
text: 'Ambassador or Deputy Assistant Secretary',
disabled_ind: false,
},
{
code: 'F1',
text: 'Pickering Fellows',
disabled_ind: false,
},
{
code: 'F2',
text: 'Rangel Fellows',
disabled_ind: false,
},
{
code: 'P',
text: 'Pickering/Rangel Fellows',
disabled_ind: false,
},
],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you use these in multiple tests, abstract to a common variable

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Thanks

};

it('is defined', () => {
const wrapper = shallow(<ClientBadgeList
{...props}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,26 @@
exports[`ClientBadgeList matches snapshot 1`] = `
<div
className="usa-grid-full client-badge-list"
/>
>
<ClientBadge
key="3"
status={true}
type="3"
/>
<ClientBadge
key="T"
status={true}
type="T"
/>
<ClientBadge
key="C"
status={true}
type="C"
/>
<ClientBadge
key="4"
status={false}
type="4"
/>
</div>
`;