Skip to content

Commit

Permalink
Merge pull request #369 from flexion/111_add_bar_number
Browse files Browse the repository at this point in the history
add bar number to view and seed
  • Loading branch information
kkoskelin authored Dec 13, 2018
2 parents 1537f3c + 0a4a4f6 commit fbffa64
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion efcms-service/storage/fixtures/efcms.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"userId": "respondent",
"respondentId": "respondent",
"email": "testrespondent@example.com",
"token": "respondent"
"token": "respondent",
"barNumber": "IR1228"
},
"userId": "taxpayer",
"irsSendDate": "2018-12-12T23:32:48.416Z",
Expand Down
6 changes: 5 additions & 1 deletion web-client/src/presenter/computeds/formattedCaseDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ const formatCase = (caseDetail, form) => {
const result = _.cloneDeep(caseDetail);

if (result.documents) result.documents.map(formatDocument);

if (result.respondent)
result.respondent.formattedName = `${result.respondent.name} ${
result.respondent.barNumber
}`;
result.createdAtFormatted = moment(result.createdAt).format('L');
result.irsDateFormatted = moment(result.irsDate).format('L LT');
result.payGovDateFormatted = moment(result.payGovDate).format('L');
Expand All @@ -29,6 +32,7 @@ const formatCase = (caseDetail, form) => {

result.status =
result.status === 'general' ? 'general docket' : result.status;

return result;
};

Expand Down
9 changes: 9 additions & 0 deletions web-client/src/tests/computeds.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ describe('formatted case details computed', () => {
});
expect(result[0].irsDateFormatted).toContain('11/21/2018');
});

it('formats the respondent name to include barnumber', () => {
const result = runCompute(formattedCases, {
state: {
cases: [{ respondent: { name: 'test', barNumber: '123' } }],
},
});
expect(result[0].respondent.formattedName).toContain('test 123');
});
});

describe('formatted search parameters computed', () => {
Expand Down
4 changes: 2 additions & 2 deletions web-client/src/views/PartyInformation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { state } from 'cerebral';

export default connect(
{
caseDetail: state.caseDetail,
caseDetail: state.formattedCaseDetail,
},
function PartyInformation({ caseDetail }) {
return (
Expand Down Expand Up @@ -42,7 +42,7 @@ export default connect(
<React.Fragment>
<h4>Respondent</h4>
<address>
<p>{caseDetail.respondent.name}</p>
<p>{caseDetail.respondent.formattedName}</p>
<p>
<span className="address-line">
{caseDetail.respondent.addressLine1}
Expand Down

0 comments on commit fbffa64

Please sign in to comment.