Skip to content

Commit

Permalink
[CST] - Remove DurationCard since it is no longer being used in the C…
Browse files Browse the repository at this point in the history
…ST for appeals (#28836)

* remove all code referencing duration card

* update code
  • Loading branch information
pmclaren19 authored Mar 28, 2024
1 parent 19c6d65 commit 25a6ab8
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 376 deletions.
14 changes: 0 additions & 14 deletions src/applications/claims-status/components/appeals-v2/Docket.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { flow, sortBy, toPairs } from 'lodash';
import omit from 'platform/utilities/data/omit';

import DocketCard from './DocketCard';
import DurationCard from './DurationCard';
import {
APPEAL_ACTIONS,
DOCKET_TYPES,
Expand Down Expand Up @@ -50,11 +49,6 @@ function Docket({
'MMMM YYYY',
);

const etaFormatted =
eta &&
eta[amaDocket] &&
moment(eta[amaDocket], 'YYYY-MM-DD').format('MMMM YYYY');

const otherEtas = flow(
e => omit(amaDocket, e),
toPairs,
Expand Down Expand Up @@ -148,14 +142,6 @@ function Docket({
</p>
{yourPlaceText}
{ahead && <DocketCard total={total} ahead={ahead} docket={amaDocket} />}
{etaFormatted && (
<DurationCard
durationText={etaFormatted}
cardDescription={`Estimate of when your appeal will reach the front of the ${getDocketName(
amaDocket,
)} docket line`}
/>
)}
<h2>Is there a way to prioritize my appeal?</h2>
<p>
If you are suffering a serious illness or are in financial distress,
Expand Down

This file was deleted.

17 changes: 2 additions & 15 deletions src/applications/claims-status/components/appeals-v2/NextEvent.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';
import DurationCard from './DurationCard';

const NextEvent = ({
title,
description,
durationText,
cardDescription,
showSeparator,
}) => (
const NextEvent = ({ description, showSeparator, title }) => (
<li className="next-event">
<h3>{title}</h3>
<div>{description}</div>
<DurationCard
durationText={durationText}
cardDescription={cardDescription}
/>
{showSeparator && <span className="sidelines">or</span>}
</li>
);

NextEvent.propTypes = {
title: PropTypes.string.isRequired,
description: PropTypes.element.isRequired,
durationText: PropTypes.string.isRequired,
cardDescription: PropTypes.string.isRequired,
showSeparator: PropTypes.bool.isRequired,
title: PropTypes.string.isRequired,
};

export default NextEvent;
27 changes: 0 additions & 27 deletions src/applications/claims-status/components/appeals-v2/WhatsNext.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import NextEvent from './NextEvent';
import DurationCard from './DurationCard';

const WhatsNext = ({ nextEvents }) => {
const { header, events } = nextEvents;
Expand All @@ -10,35 +9,15 @@ const WhatsNext = ({ nextEvents }) => {
key={event.title}
title={event.title}
description={event.description}
durationText={event.durationText}
cardDescription={event.cardDescription}
// show a separator after all events except the last one
showSeparator={index !== events.length - 1}
/>
));

// Some current status types (really, just pendingSoc) have multiple
// NextEvents that each have the same duration. In these cases, we want to
// show one duration card, above the NextEvent list, instead of one card for
// each NextEvent item. getNextEvents() will only return a headerCard
// property if the corresponding current status type should be treated in
// this way
let headerDurationCard = null;
if (nextEvents.headerCard) {
const { durationText, cardDescription } = nextEvents.headerCard;
headerDurationCard = (
<DurationCard
durationText={durationText}
cardDescription={cardDescription}
/>
);
}

return (
<div>
<h2>What happens next?</h2>
<p>{header}</p>
{headerDurationCard}
<ul className="appeals-next-list">{eventsList}</ul>
</div>
);
Expand All @@ -47,16 +26,10 @@ const WhatsNext = ({ nextEvents }) => {
WhatsNext.propTypes = {
nextEvents: PropTypes.shape({
header: PropTypes.string.isRequired,
headerCard: PropTypes.shape({
durationText: PropTypes.string.isRequired,
cardDescription: PropTypes.string.isRequired,
}),
events: PropTypes.arrayOf(
PropTypes.shape({
title: PropTypes.string.isRequired,
description: PropTypes.element.isRequired,
durationText: PropTypes.string.isRequired,
cardDescription: PropTypes.string.isRequired,
}),
).isRequired,
}).isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ describe('Appeals V2 Docket', () => {
wrapper.unmount();
});

it('should render a time estimate', () => {
const wrapper = shallow(<Docket {...amaProps} />);
expect(wrapper.find('DurationCard').length).to.equal(1);
wrapper.unmount();
});

it('should include docket switch instructions if eligible', () => {
const wrapper = shallow(<Docket {...amaProps} />);
expect(wrapper.text()).to.contain(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const defaultProps = {
your appeal to the Board of Veterans’ Appeals. This evidence could cause VBA
to grant your appeal, but if not, they will need to produce an additional
Statement of the Case.`,
durationText: '11 months',
cardDescription: 'Test description',
showSeparator: true,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ describe('<WhatsNext/>', () => {
{
title: 'Additional evidence',
description: <p>Some description goes here</p>,
durationText: '11 months',
cardDescription: 'Test description contents',
},
{
title: 'Appeal certified to the Board',
description: <p>Another description goes here</p>,
durationText: '2 months',
cardDescription: 'Test description contents',
},
];

Expand Down Expand Up @@ -51,29 +47,6 @@ describe('<WhatsNext/>', () => {
wrapper.unmount();
});

it('renders a header DurationCard if headerCard property exists', () => {
const props = {
nextEvents: {
header: '',
headerCard: {
durationText: 'Some duration text goes here',
cardDescription: 'Not sure how long this takes',
},
events: [],
},
};

const wrapper = shallow(<WhatsNext {...props} />);
expect(wrapper.find('DurationCard').length).to.equal(1);
wrapper.unmount();
});

it('does not render a header DurationCard if no headerCard property exists', () => {
const wrapper = shallow(<WhatsNext {...defaultProps} />);
expect(wrapper.find('DurationCard').length).to.equal(0);
wrapper.unmount();
});

it('renders a list of all next events for a given currentStatus', () => {
const props = {
...defaultProps,
Expand Down
58 changes: 3 additions & 55 deletions src/applications/claims-status/tests/utils/helpers.unit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
getAlertContent,
getStatusContents,
getNextEvents,
makeDurationText,
makeDecisionReviewContent,
addStatusToIssues,
isolateAppeal,
Expand Down Expand Up @@ -865,57 +864,6 @@ describe('Disability benefits helpers: ', () => {
});
});

describe('makeDurationText', () => {
const inputs = {
exactSingular: [1, 1],
exactPlural: [2, 2],
range: [1, 8],
empty: [],
nonsense: 'danger, danger',
};

it('should return an object with header and description properties', () => {
const testText = makeDurationText(inputs.exactSingular);
expect(!!testText.header && !!testText.description).to.be.true;
});

it('should return an object with header and description properties with nonsense input', () => {
const testText = makeDurationText(inputs.nonsense);
expect(testText.header).to.equal('');
expect(testText.description).to.equal('');
});

it('should return an object with header and description properties with empty array input', () => {
const testText = makeDurationText(inputs.empty);
expect(testText.header).to.equal('');
expect(testText.description).to.equal('');
});

it('should return an object with header and description properties with no input', () => {
const testText = makeDurationText();
expect(testText.header).to.equal('');
expect(testText.description).to.equal('');
});

it('should format exact singular time estimates', () => {
const testText = makeDurationText(inputs.exactSingular);
expect(testText.header).to.equal('1 month');
expect(testText.description).to.equal('about 1 month');
});

it('should format exact plural time estimates', () => {
const testText = makeDurationText(inputs.exactPlural);
expect(testText.header).to.equal('2 months');
expect(testText.description).to.equal('about 2 months');
});

it('should format range time estimates', () => {
const testText = makeDurationText(inputs.range);
expect(testText.header).to.equal('1–8 months');
expect(testText.description).to.equal('between 1 and 8 months');
});
});

describe('getNextEvents', () => {
it('returns an object with a header property', () => {
const type = STATUS_TYPES.pendingCertificationSsoc;
Expand Down Expand Up @@ -945,9 +893,9 @@ describe('Disability benefits helpers: ', () => {
expect(events.length).to.equal(2);
const firstEvent = events[0];
const secondEvent = events[1];
// each of the 2 'remandSsoc' nextEvents has 4 properties
expect(Object.keys(firstEvent).length).to.equal(4);
expect(Object.keys(secondEvent).length).to.equal(4);
// each of the 2 'remandSsoc' nextEvents has 2 properties
expect(Object.keys(firstEvent).length).to.equal(2);
expect(Object.keys(secondEvent).length).to.equal(2);
});
});

Expand Down
Loading

0 comments on commit 25a6ab8

Please sign in to comment.