Skip to content

Commit

Permalink
Merge pull request #5596 from flexion/dev-snapshot-062420-01
Browse files Browse the repository at this point in the history
Dev snapshot 062420 01
  • Loading branch information
matthopson authored Jun 24, 2020
2 parents 6d6fbc4 + 89d7811 commit ff40001
Show file tree
Hide file tree
Showing 36 changed files with 515 additions and 159 deletions.
10 changes: 5 additions & 5 deletions shared/src/business/useCases/addCoversheetInteractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports.generateCoverSheetData = ({
(documentEntity.servedAt &&
applicationContext
.getUtilities()
.formatDateString(documentEntity.servedAt, 'MMDDYYYY')) ||
.formatDateString(documentEntity.servedAt, 'MMDDYY')) ||
'';

let dateReceivedFormatted;
Expand All @@ -33,22 +33,22 @@ exports.generateCoverSheetData = ({
(documentEntity.createdAt &&
applicationContext
.getUtilities()
.formatDateString(documentEntity.createdAt, 'MMDDYYYY')) ||
.formatDateString(documentEntity.createdAt, 'MMDDYY')) ||
'';
} else {
dateReceivedFormatted =
(documentEntity.createdAt &&
applicationContext
.getUtilities()
.formatDateString(documentEntity.createdAt, 'MM/DD/YYYY hh:mm a')) ||
.formatDateString(documentEntity.createdAt, 'MM/DD/YY hh:mm a')) ||
'';
}

const dateFiledFormatted =
(documentEntity.filingDate &&
applicationContext
.getUtilities()
.formatDateString(documentEntity.filingDate, 'MMDDYYYY')) ||
.formatDateString(documentEntity.filingDate, 'MMDDYY')) ||
'';

const caseCaptionToUse = useInitialData
Expand Down Expand Up @@ -84,7 +84,7 @@ exports.generateCoverSheetData = ({
dateFiledLodgedLabel: isLodged ? 'Lodged' : 'Filed',
dateReceived: dateReceivedFormatted,
dateServed: dateServedFormatted,
docketNumber: `Docket Number: ${docketNumberWithSuffix}`,
docketNumber: `Docket No.: ${docketNumberWithSuffix}`,
documentTitle,
electronicallyFiled: !documentEntity.isPaper,
mailingDate: documentEntity.mailingDate || '',
Expand Down
14 changes: 7 additions & 7 deletions shared/src/business/useCases/addCoversheetInteractor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ describe('addCoversheetInteractor', () => {
},
});

expect(result.dateFiledLodged).toEqual('04/19/2019');
expect(result.dateFiledLodged).toEqual('04/19/19');
});

it('shows does not show the filing date if the document does not have a valid filingDate', async () => {
Expand Down Expand Up @@ -371,7 +371,7 @@ describe('addCoversheetInteractor', () => {
},
});

expect(result.dateReceived).toEqual('04/19/2019 10:45 am');
expect(result.dateReceived).toEqual('04/19/19 10:45 am');
});

it('shows does not show the received date if the document does not have a valid createdAt and is electronically filed', async () => {
Expand Down Expand Up @@ -418,7 +418,7 @@ describe('addCoversheetInteractor', () => {
},
});

expect(result.dateReceived).toEqual('04/19/2019');
expect(result.dateReceived).toEqual('04/19/19');
});

it('shows does not show the received date if the document does not have a valid createdAt and is filed by paper', async () => {
Expand Down Expand Up @@ -467,7 +467,7 @@ describe('addCoversheetInteractor', () => {
},
});

expect(result.dateServed).toEqual('04/20/2019');
expect(result.dateServed).toEqual('04/20/19');
});

it('does not display the service date if servedAt is not present', async () => {
Expand Down Expand Up @@ -515,7 +515,7 @@ describe('addCoversheetInteractor', () => {
},
});

expect(result.docketNumber).toEqual('Docket Number: 102-19');
expect(result.docketNumber).toEqual('Docket No.: 102-19');
});

it('returns the docket number with suffix along with a Docket Number label', async () => {
Expand All @@ -540,7 +540,7 @@ describe('addCoversheetInteractor', () => {
},
});

expect(result.docketNumber).toEqual('Docket Number: 102-19S');
expect(result.docketNumber).toEqual('Docket No.: 102-19S');
});

it('displays Electronically Filed when the document is filed electronically', async () => {
Expand Down Expand Up @@ -729,7 +729,7 @@ describe('addCoversheetInteractor', () => {
useInitialData: true,
});

expect(result.docketNumber).toEqual('Docket Number: 102-19Z');
expect(result.docketNumber).toEqual('Docket No.: 102-19Z');
expect(result.caseTitle).toEqual('Janie and Jackie Petitioner, ');
});
});
Expand Down
34 changes: 27 additions & 7 deletions shared/src/business/utilities/documentGenerators.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const docketRecord = async ({ applicationContext, data }) => {
const footerHtml = reactTemplateGenerator({
componentName: 'DatePrintedFooter',
data: {
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YYYY'),
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YY'),
},
});

Expand Down Expand Up @@ -313,7 +313,7 @@ const pendingReport = async ({ applicationContext, data }) => {
const footerHtml = reactTemplateGenerator({
componentName: 'DatePrintedFooter',
data: {
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YYYY'),
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YY'),
},
});

Expand Down Expand Up @@ -404,7 +404,6 @@ const standingPretrialNotice = async ({ applicationContext, data }) => {
const reactStandingPretrialNoticeTemplate = reactTemplateGenerator({
componentName: 'StandingPretrialNotice',
data: {
footerDate,
options: {
caseCaptionExtension,
caseTitle,
Expand All @@ -431,13 +430,24 @@ const standingPretrialNotice = async ({ applicationContext, data }) => {
},
});

let footerHtml = '';
if (footerDate) {
footerHtml = reactTemplateGenerator({
componentName: 'DateServedFooter',
data: {
dateServed: footerDate,
},
});
}

const pdf = await applicationContext
.getUseCases()
.generatePdfFromHtmlInteractor({
applicationContext,
contentHtml: pdfContentHtml,
displayHeaderFooter: true,
docketNumber: docketNumberWithSuffix,
footerHtml,
headerHtml,
overwriteHeader: true,
});
Expand All @@ -457,7 +467,6 @@ const standingPretrialOrder = async ({ applicationContext, data }) => {
const reactStandingPretrialOrderTemplate = reactTemplateGenerator({
componentName: 'StandingPretrialOrder',
data: {
footerDate,
options: {
caseCaptionExtension,
caseTitle,
Expand All @@ -484,13 +493,24 @@ const standingPretrialOrder = async ({ applicationContext, data }) => {
},
});

let footerHtml = '';
if (footerDate) {
footerHtml = reactTemplateGenerator({
componentName: 'DateServedFooter',
data: {
dateServed: footerDate,
},
});
}

const pdf = await applicationContext
.getUseCases()
.generatePdfFromHtmlInteractor({
applicationContext,
contentHtml: pdfContentHtml,
displayHeaderFooter: true,
docketNumber: docketNumberWithSuffix,
footerHtml,
headerHtml,
overwriteHeader: true,
});
Expand Down Expand Up @@ -526,7 +546,7 @@ const caseInventoryReport = async ({ applicationContext, data }) => {
const footerHtml = reactTemplateGenerator({
componentName: 'DatePrintedFooter',
data: {
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YYYY'),
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YY'),
},
});

Expand Down Expand Up @@ -585,7 +605,7 @@ const trialCalendar = async ({ applicationContext, data }) => {
const footerHtml = reactTemplateGenerator({
componentName: 'DatePrintedFooter',
data: {
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YYYY'),
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YY'),
},
});

Expand Down Expand Up @@ -635,7 +655,7 @@ const trialSessionPlanningReport = async ({ applicationContext, data }) => {
const footerHtml = reactTemplateGenerator({
componentName: 'DatePrintedFooter',
data: {
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YYYY'),
datePrinted: applicationContext.getUtilities().formatNow('MM/DD/YY'),
},
});

Expand Down
74 changes: 68 additions & 6 deletions shared/src/business/utilities/documentGenerators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ describe('documentGenerators', () => {
caseCaptionExtension: 'Petitioner',
caseTitle: 'Test Person',
certificateOfService: true,
dateFiledLodged: '01/01/2020',
dateFiledLodged: '01/01/20',
dateFiledLodgedLabel: 'Filed',
dateReceived: '01/02/2020',
dateServed: '01/03/2020',
dateReceived: '01/02/20',
dateServed: '01/03/20',
docketNumberWithSuffix: '123-45S',
documentTitle: 'Petition',
electronicallyFiled: true,
Expand Down Expand Up @@ -362,7 +362,8 @@ describe('documentGenerators', () => {
applicationContext,
data: {
caseCaptionExtension: 'Petitioner(s)',
caseTitle: 'Test Petitioner',
caseTitle:
'Test Petitioner, Another Petitioner, and Yet Another Petitioner',
docketNumberWithSuffix: '123-45S',
footerDate: '02/02/20',
trialInfo: {
Expand Down Expand Up @@ -431,8 +432,41 @@ describe('documentGenerators', () => {
});
});

describe('notice', () => {
it('generates a Notice document', async () => {
const pdf = await order({
applicationContext,
data: {
caseCaptionExtension: 'Petitioner(s)',
caseTitle: 'Test Petitioner',
docketNumberWithSuffix: '123-45S',
orderContent: `<p>This is some sample notice text.</p>
<p>NOTICE that the joint motion for continuance is granted in that thesecases are stricken for trial from the Court's January 27, 2020, Los Angeles, California, trial session. It is further</p>
<p>NOTICE that the joint motion to remand to respondent's Appeals Office is granted and these cases are
remanded to respondent's Appeals Office for a supplemental collection due process hearing. It is further</p>`,
orderTitle: 'NOTICE',
signatureText: 'Test Signature',
},
});

// Do not write PDF when running on CircleCI
if (process.env.PDF_OUTPUT) {
writePdfFile('Notice', pdf);
expect(applicationContext.getChromiumBrowser).toHaveBeenCalled();
}

expect(
applicationContext.getUseCases().generatePdfFromHtmlInteractor,
).toHaveBeenCalled();
expect(applicationContext.getNodeSass).toHaveBeenCalled();
expect(applicationContext.getPug).toHaveBeenCalled();
});
});

describe('order', () => {
it('generates a Standing Pre-trial Order document', async () => {
it('generates an Order document', async () => {
const pdf = await order({
applicationContext,
data: {
Expand All @@ -450,9 +484,37 @@ describe('documentGenerators', () => {
located closest to petitioners' residence (or at such other place as may be mutually agreed upon) at a
reasonable and mutually agreed upon date and time, but no later than April 1, 2020. It is further</p>
<p>ORDERED that each party shall, on or before April 15, 2020, file with the Court, and serve on the other party, a report regarding the then present status of these cases. It is further</p>
<p>ORDERED that the joint motion to remand to respondent's Appeals Office is granted and these cases are
remanded to respondent's Appeals Office for a supplemental collection due process hearing. It is further</p>
<p>ORDERED that respondent shall offer petitioners an administrative hearing at respondent's Appeals Office
located closest to petitioners' residence (or at such other place as may be mutually agreed upon) at a
reasonable and mutually agreed upon date and time, but no later than April 1, 2020. It is further</p>
<p>ORDERED that each party shall, on or before April 15, 2020, file with the Court, and serve on the other party, a report regarding the then present status of these cases. It is further</p>
<p>ORDERED that the joint motion for continuance is granted in that thesecases are stricken for trial from the Court's January 27, 2020, Los Angeles, California, trial session. It is further</p>
<p>ORDERED that the joint motion to remand to respondent's Appeals Office is granted and these cases are
remanded to respondent's Appeals Office for a supplemental collection due process hearing. It is further</p>
<p>ORDERED that respondent shall offer petitioners an administrative hearing at respondent's Appeals Office
located closest to petitioners' residence (or at such other place as may be mutually agreed upon) at a
reasonable and mutually agreed upon date and time, but no later than April 1, 2020. It is further</p>
<p>ORDERED that each party shall, on or before April 15, 2020, file with the Court, and serve on the other party, a report regarding the then present status of these cases. It is further</p>
<p>ORDERED that the joint motion to remand to respondent's Appeals Office is granted and these cases are
remanded to respondent's Appeals Office for a supplemental collection due process hearing. It is further</p>
<p>ORDERED that respondent shall offer petitioners an administrative hearing at respondent's Appeals Office
located closest to petitioners' residence (or at such other place as may be mutually agreed upon) at a
reasonable and mutually agreed upon date and time, but no later than April 1, 2020. It is further</p>
<p>ORDERED that each party shall, on or before April 15, 2020, file with the Court, and serve on the other party, a report regarding the then present status of these cases. It is further</p>`,
orderTitle: 'ORDER',
signatureText: 'Test Signature',
},
});

Expand Down
Loading

0 comments on commit ff40001

Please sign in to comment.