From 90cce9585ea9dead1fae1e73d1dce0a0f7b007ed Mon Sep 17 00:00:00 2001 From: Kristen Lohman Date: Tue, 23 Jun 2020 12:04:01 -0400 Subject: [PATCH 1/8] wiki updates for messages 4609 --- wikiwiki/Message-Queues.md | 35 ++++++++++++++++++ wikiwiki/Messages.md | 74 ++++++++++++++++++++++++++------------ wikiwiki/README.md | 1 + 3 files changed, 88 insertions(+), 22 deletions(-) create mode 100644 wikiwiki/Message-Queues.md diff --git a/wikiwiki/Message-Queues.md b/wikiwiki/Message-Queues.md new file mode 100644 index 00000000000..06246ebdd4e --- /dev/null +++ b/wikiwiki/Message-Queues.md @@ -0,0 +1,35 @@ +[Return to Directory](./README.md) + +## Message sorting +* Inbox - oldest to newest by Received date +* Sent - newest to oldest by Sent date +* Completed - newest to oldest by Completed date + +## Unread messages +* When a new message is received, a closed envelope icon is displayed on page refresh (not in real time) next to the Messages link in the header +* Total number of unread messages is displayed next to the My Messages page title +* Unread messages are indicated by bold text (Document Title) and a closed envelope icon +* Messages are considered “read” when the user clicks on the item into the Document Detail page from their My Messages inbox +* Section Messages inbox does not indicate unread messages with an icon +* Message count shown on Section Messages should be number of TOTAL messages in box + +## Sent messages +* Sent messages are visible in the Sent box for 7 days + +## Completed messages +**Completed** +* displays the date/time the message was completed +* messages sorted newest to oldest by date/time completed + +**Last Message** +* Displays Subject Line link and message from most recent message in this thread (the last message before the message thread was completed) +* On click of Subject Link link, navigate to Message Detail screen + +**Comment** +* Displays text from "Add Comment" field (if applicable) + + +## Message icons +* If Unread - Bold with blue envelope icon +* If High Priority - Red exclamation point (not implemented yet) +* If High Priority and Unread - Red exclamation point and bold (not implemented yet) diff --git a/wikiwiki/Messages.md b/wikiwiki/Messages.md index f33bf9d3429..3966bbc16a1 100644 --- a/wikiwiki/Messages.md +++ b/wikiwiki/Messages.md @@ -1,27 +1,6 @@ [Return to Directory](./README.md) -# Messages - -## Message sorting -* Inbox - oldest to newest by Received date -* Sent - newest to oldest by Sent date -* Completed - newest to oldest by Completed date - -## Unread messages -* When a new message is received, a closed envelope icon is displayed on page refresh (not in real time) next to the Messages link in the header -* Total number of unread messages is displayed next to the My Messages page title -* Unread messages are indicated by bold text (Document Title) and a closed envelope icon -* Messages are considered “read” when the user clicks on the item into the Document Detail page from their My Messages inbox -* Section Messages inbox does not indicate unread messages with an icon -* Message count shown on Section Messages should be number of TOTAL messages in box - -## Sent messages -* Sent messages are visible in the Sent box for 7 days - -## Message icons -* If Unread - Bold with blue envelope icon -* If High Priority - Red exclamation point (not implemented yet) -* If High Priority and Unread - Red exclamation point and bold (not implemented yet) +# Message Actions ## Create New Message * "Create New Message" is displayed in the actions dropdown on Case Detail header for all internal users @@ -44,3 +23,54 @@ * Message Detail screen is created * Message appears in Sent box for sending user and Section Sent box * Message appears in the recipient's My Messages Inbox, and the Section Messages Inbox + +## Reply to a Message +**Recipient** +* original sender is displayed read-only as recipient + +**Subject line** +* current subject is displayed (i.e. the subject line sent in the original message) +* subject line field is editable + +**Attachments** +* Displays all documents attached to message in read-only + +**On Send** +* App remains on Message Detail with success message displayed +* Sent message displays in My Messages > Sent and Section Messages > Sent box +* Message displays in My Messages > Inbox / Section Messages > Inbox of the recipient +* Message thread displays on Message Detail screen + +## Forward a Message +**Select section/ Select recipient** +* User must select section and then recipient from dropdowns + +**Subject Line** +* current subject is displayed (i.e. the subject line sent in the original message) +* subject line field is editable + +**Attachments** +* Displays all documents attached to message in read-only +* User is able to add up to five total attached documents + +**On Send** +* App remains on Message Detail with success message displayed +* Sent message displays in My Messages > Sent and Section Messages > Sent box +* Message displays in My Messages > Inbox / Section Messages > Inbox of the recipient +* Message thread displays on Message Detail screen + +## Complete a Message +**Add Comment** +* Optional field - current functionality + +**On Complete** +* App remains on Message Detail with completed warning displayed +* Message no longer displays in any user Inbox +* Completed message displays in My Messages > Completed and Section Messages > Completed +* Message thread displays as Completed on Message Detail screen + + +## Message Thread +* If there is more than one message in a thread, messages are displayed in accordion +* Current ("active") message is displayed as accordion header +* Expanded accordion displays all messages sorted newest to oldest diff --git a/wikiwiki/README.md b/wikiwiki/README.md index d5726a15e4b..c6b6ae00b7d 100644 --- a/wikiwiki/README.md +++ b/wikiwiki/README.md @@ -9,6 +9,7 @@ ### System Documentation * [Site Access](./Site-Access.md) * [Messages](./Messages.md) +* [Messages Queues](./Message-Queues.md) * [Petitions](./Petitions.md) * [Create Case from Paper Petition](./Create-Case-From-Paper-Petition.md) * [Review and Serve Petition](./Review-and-Serve-Petition.md) From 54c87bce554b68d666619afedaf34ef0f5bc98a9 Mon Sep 17 00:00:00 2001 From: Mrinalini Date: Tue, 23 Jun 2020 11:09:02 -0700 Subject: [PATCH 2/8] [skip ci] WIP migration script for missing servedAt fields in documents --- .../00009-document-required-fields.js | 45 +++++ .../00009-document-required-fields.test.js | 156 ++++++++++++++++++ web-api/migrations/utilities.js | 3 + 3 files changed, 204 insertions(+) create mode 100644 web-api/migrations/00009-document-required-fields.js create mode 100644 web-api/migrations/00009-document-required-fields.test.js diff --git a/web-api/migrations/00009-document-required-fields.js b/web-api/migrations/00009-document-required-fields.js new file mode 100644 index 00000000000..da34abfad13 --- /dev/null +++ b/web-api/migrations/00009-document-required-fields.js @@ -0,0 +1,45 @@ +const createApplicationContext = require('../src/applicationContext'); +const { isDocumentRecord, upGenerator } = require('./utilities'); +const { isEmpty } = require('lodash'); +const applicationContext = createApplicationContext({}); +const { Document } = require('../../shared/src/business/entities/Document'); + +const DEFAULT_SERVED_AT_DATE = new Date().toISOString(); +const DEFAULT_SERVED_PARTIES = [ + { + name: 'Served via migration.', + }, +]; + +const mutateRecord = async item => { + if (isDocumentRecord(item)) { + if ( + (!item.servedAt && !item.servedParties) || + (item.servedAt && !isEmpty(item.servedParties)) + ) { + return; + } + return addMissingFieldsToDocument(item); + } +}; + +module.exports = { mutateRecord, up: upGenerator(mutateRecord) }; + +/** + * checks for missing required fields and updates them if necessary + * + * @param {object} item the document to be updated + * @returns {Object} the updated document object + */ +function addMissingFieldsToDocument(item) { + if (!item.servedAt) { + item.servedAt = DEFAULT_SERVED_AT_DATE; + } + if (isEmpty(item.servedParties)) { + item.servedParties = DEFAULT_SERVED_PARTIES; + } + const documentToUpdate = new Document({ ...item }, { applicationContext }) + .validate() + .toRawObject(); + return { ...item, ...documentToUpdate }; +} diff --git a/web-api/migrations/00009-document-required-fields.test.js b/web-api/migrations/00009-document-required-fields.test.js new file mode 100644 index 00000000000..c42a93941d6 --- /dev/null +++ b/web-api/migrations/00009-document-required-fields.test.js @@ -0,0 +1,156 @@ +const { forAllRecords } = require('./utilities'); +const { up } = require('./00009-document-required-fields'); + +describe('document required fields test', () => { + let documentClient; + let scanStub; + let putStub; + let getStub; + + let mockDocumentItemWithOnlyServedAt; + let mockDocumentItemWithOnlyServedParties; + let mockDocumentItemNotServed; + let mockDocumentItemServed; + let mockItems = {}; + + beforeEach(() => { + mockItems = { + notServed: { ...mockDocumentItemNotServed }, + scanList: [ + { + ...mockDocumentItemWithOnlyServedAt, + pk: 'not-a-document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + sk: 'not-a-document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + }, + { ...mockDocumentItemWithOnlyServedAt }, + { ...mockDocumentItemWithOnlyServedParties }, + { ...mockDocumentItemServed }, + { ...mockDocumentItemNotServed }, + ], + served: { ...mockDocumentItemServed }, + servedAt: { ...mockDocumentItemWithOnlyServedAt }, + servedParties: { ...mockDocumentItemWithOnlyServedParties }, + }; + }); + + beforeAll(() => { + mockDocumentItemWithOnlyServedAt = { + createdAt: '2018-11-21T20:49:28.192Z', + docketNumber: '101-18', + documentId: 'c6b81f4d-1e47-423a-8caf-6d2fdc3d3859', + documentTitle: 'Petition', + documentType: 'Petition', + eventCode: 'P', + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + processingStatus: 'pending', + servedAt: '2018-11-21T20:49:28.192Z', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + userId: '7805d1ab-18d0-43ec-bafb-654e83405416', + workItems: [], + }; + + mockDocumentItemWithOnlyServedParties = { + createdAt: '2018-11-21T20:49:28.192Z', + docketNumber: '101-18', + documentId: 'c6b81f4d-1e47-423a-8caf-6d2fdc3d3859', + documentTitle: 'Petition', + documentType: 'Petition', + eventCode: 'P', + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + processingStatus: 'pending', + servedParties: [{ name: 'Test Petitioner' }], + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + userId: '7805d1ab-18d0-43ec-bafb-654e83405416', + workItems: [], + }; + + mockDocumentItemNotServed = { + createdAt: '2018-11-21T20:49:28.192Z', + docketNumber: '101-18', + documentId: 'c6b81f4d-1e47-423a-8caf-6d2fdc3d3859', + documentTitle: 'Petition', + documentType: 'Petition', + eventCode: 'P', + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + processingStatus: 'pending', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + userId: '7805d1ab-18d0-43ec-bafb-654e83405416', + workItems: [], + }; + + mockDocumentItemServed = { + createdAt: '2018-11-21T20:49:28.192Z', + docketNumber: '101-18', + documentId: 'c6b81f4d-1e47-423a-8caf-6d2fdc3d3859', + documentTitle: 'Petition', + documentType: 'Petition', + eventCode: 'P', + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + processingStatus: 'pending', + servedAt: '2018-11-21T20:49:28.192Z', + servedParties: [{ name: 'Test Petitioner' }], + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + userId: '7805d1ab-18d0-43ec-bafb-654e83405416', + workItems: [], + }; + + scanStub = jest.fn().mockReturnValue({ + promise: async () => ({ + Items: mockItems.scanList, + }), + }); + + putStub = jest.fn().mockReturnValue({ + promise: async () => ({}), + }); + + getStub = jest.fn().mockReturnValue({ + promise: async () => ({ + Item: mockItems.scanList, + }), + }); + + documentClient = { + get: getStub, + put: putStub, + scan: scanStub, + }; + }); + + it.only('does not mutate non document records', async () => { + await up(documentClient, '', forAllRecords); + + //have a pair of expect statements for mock calls [0] to be something + expect(putStub.mock.calls[0]).not.toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + }); + // expect(putStub).toHaveBeenCalledWith(mockItems.scanList[0]); + }); + + it('does not mutate document records that have not been served', async () => { + await up(documentClient, '', forAllRecords); + + expect(putStub).not.toHaveBeenCalled(); + }); + + it('does not mutate document records that have both servedAt and servedParties fields defined', async () => { + await up(documentClient, '', forAllRecords); + + expect(putStub).not.toHaveBeenCalled(); + }); + + it('mutates document records that have a defined servedAt field when servedParties is undefined', async () => { + await up(documentClient, '', forAllRecords); + + expect(putStub.mock.calls.length).toEqual(1); + expect(putStub.mock.calls[0][0].Item).toMatchObject({ + ...mockItems.scanList[1], + servedParties: [ + { + name: 'Served via migration.', + }, + ], + }); + }); +}); diff --git a/web-api/migrations/utilities.js b/web-api/migrations/utilities.js index da001471732..cd371aa7023 100644 --- a/web-api/migrations/utilities.js +++ b/web-api/migrations/utilities.js @@ -7,6 +7,8 @@ const isUserCaseMappingRecord = item => item.pk.startsWith('user|') && item.sk.startsWith('case|'); const isNewUserCaseMappingRecord = item => !!item.gsi1pk && item.gsi1pk.startsWith('user-case|'); +const isDocumentRecord = item => + item.pk.startsWith('case|') && item.sk.startsWith('document|'); const forAllRecords = async (documentClient, tableName, cb) => { let hasMoreResults = true; @@ -55,6 +57,7 @@ module.exports = { forAllRecords, isCaseMessageRecord, isCaseRecord, + isDocumentRecord, isNewUserCaseMappingRecord, isTrialSessionRecord, isUserCaseMappingRecord, From 436fc6bf98cac0a3d842a55a236a1a69cc6e2b46 Mon Sep 17 00:00:00 2001 From: Cody Seibert Date: Tue, 23 Jun 2020 14:31:29 -0400 Subject: [PATCH 3/8] docker is built on a previous circle ci step --- web-api/terraform/bin/deploy-app.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/web-api/terraform/bin/deploy-app.sh b/web-api/terraform/bin/deploy-app.sh index 6aaa3e22f63..84eebb5ac94 100755 --- a/web-api/terraform/bin/deploy-app.sh +++ b/web-api/terraform/bin/deploy-app.sh @@ -56,14 +56,6 @@ pushd ../template/websockets npx parcel build index.js --target node --bundle-node-modules --no-minify popd -pushd ../../runtimes/puppeteer -./build.sh -popd - -pushd ../../runtimes/clamav -./build.sh -popd - # exit on any failure set -eo pipefail From 06b998fa101f895eadcc9d61884385e3e9b8c613 Mon Sep 17 00:00:00 2001 From: Rachel Schneiderman Date: Tue, 23 Jun 2020 11:46:44 -0700 Subject: [PATCH 4/8] Fixing tests --- .../00009-document-required-fields.test.js | 102 +++++++++++++----- 1 file changed, 74 insertions(+), 28 deletions(-) diff --git a/web-api/migrations/00009-document-required-fields.test.js b/web-api/migrations/00009-document-required-fields.test.js index c42a93941d6..7048584d0b9 100644 --- a/web-api/migrations/00009-document-required-fields.test.js +++ b/web-api/migrations/00009-document-required-fields.test.js @@ -14,22 +14,20 @@ describe('document required fields test', () => { let mockItems = {}; beforeEach(() => { + const notADocument = { + ...mockDocumentItemWithOnlyServedAt, + pk: 'not-a-document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + sk: 'not-a-document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + }; + mockItems = { - notServed: { ...mockDocumentItemNotServed }, scanList: [ - { - ...mockDocumentItemWithOnlyServedAt, - pk: 'not-a-document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', - sk: 'not-a-document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', - }, + { ...notADocument }, { ...mockDocumentItemWithOnlyServedAt }, { ...mockDocumentItemWithOnlyServedParties }, { ...mockDocumentItemServed }, { ...mockDocumentItemNotServed }, ], - served: { ...mockDocumentItemServed }, - servedAt: { ...mockDocumentItemWithOnlyServedAt }, - servedParties: { ...mockDocumentItemWithOnlyServedParties }, }; }); @@ -41,10 +39,10 @@ describe('document required fields test', () => { documentTitle: 'Petition', documentType: 'Petition', eventCode: 'P', - pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a9', processingStatus: 'pending', servedAt: '2018-11-21T20:49:28.192Z', - sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a9', userId: '7805d1ab-18d0-43ec-bafb-654e83405416', workItems: [], }; @@ -56,10 +54,10 @@ describe('document required fields test', () => { documentTitle: 'Petition', documentType: 'Petition', eventCode: 'P', - pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a7', processingStatus: 'pending', servedParties: [{ name: 'Test Petitioner' }], - sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a7', userId: '7805d1ab-18d0-43ec-bafb-654e83405416', workItems: [], }; @@ -71,9 +69,9 @@ describe('document required fields test', () => { documentTitle: 'Petition', documentType: 'Petition', eventCode: 'P', - pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a6', processingStatus: 'pending', - sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a6', userId: '7805d1ab-18d0-43ec-bafb-654e83405416', workItems: [], }; @@ -85,11 +83,11 @@ describe('document required fields test', () => { documentTitle: 'Petition', documentType: 'Petition', eventCode: 'P', - pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a5', processingStatus: 'pending', servedAt: '2018-11-21T20:49:28.192Z', servedParties: [{ name: 'Test Petitioner' }], - sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a5', userId: '7805d1ab-18d0-43ec-bafb-654e83405416', workItems: [], }; @@ -117,40 +115,88 @@ describe('document required fields test', () => { }; }); - it.only('does not mutate non document records', async () => { + it('does not mutate non document records', async () => { await up(documentClient, '', forAllRecords); - //have a pair of expect statements for mock calls [0] to be something - expect(putStub.mock.calls[0]).not.toMatchObject({ - pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', - sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + // notADocument + expect(putStub.mock.calls[0][0]['Item']).not.toMatchObject({ + pk: 'not-a-document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + sk: 'not-a-document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a8', + }); + // mockDocumentItemWithOnlyServedAt + expect(putStub.mock.calls[0][0]['Item']).toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a9', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a9', }); - // expect(putStub).toHaveBeenCalledWith(mockItems.scanList[0]); }); it('does not mutate document records that have not been served', async () => { await up(documentClient, '', forAllRecords); - expect(putStub).not.toHaveBeenCalled(); + expect(putStub.mock.calls.length).toBe(2); + // mockDocumentItemNotServed + expect(putStub.mock.calls[0][0]['Item']).not.toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a6', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a6', + }); + // mockDocumentItemWithOnlyServedParties + expect(putStub.mock.calls[1][0]['Item']).toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a7', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a7', + }); }); it('does not mutate document records that have both servedAt and servedParties fields defined', async () => { await up(documentClient, '', forAllRecords); - expect(putStub).not.toHaveBeenCalled(); + expect(putStub.mock.calls.length).toBe(2); + // mockDocumentItemServed + expect(putStub.mock.calls[0][0]['Item']).not.toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a6', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a6', + }); + // mockDocumentItemWithOnlyServedParties + expect(putStub.mock.calls[1][0]['Item']).toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a7', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a7', + }); }); it('mutates document records that have a defined servedAt field when servedParties is undefined', async () => { await up(documentClient, '', forAllRecords); - expect(putStub.mock.calls.length).toEqual(1); - expect(putStub.mock.calls[0][0].Item).toMatchObject({ - ...mockItems.scanList[1], + expect(putStub.mock.calls.length).toBe(2); + // mockDocumentItemWithOnlyServedParties + expect(putStub.mock.calls[0][0]['Item']).not.toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a6', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a6', + }); + // mockDocumentItemWithOnlyServedAt + expect(putStub.mock.calls[0][0]['Item']).toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a9', servedParties: [ { name: 'Served via migration.', }, ], + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a9', + }); + }); + + it('mutates document records that have a defined servedParties field when servedAt is undefined', async () => { + await up(documentClient, '', forAllRecords); + + expect(putStub.mock.calls.length).toBe(2); + // mockDocumentItemWithOnlyServedAt + expect(putStub.mock.calls[1][0]['Item']).not.toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a9', + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a9', + }); + // mockDocumentItemWithOnlyServedParties + expect(putStub.mock.calls[1][0]['Item']).toMatchObject({ + pk: 'case|3079c990-cc6c-4b99-8fca-8e31f2d9e7a7', + servedAt: expect.anything(), + sk: 'document|3079c990-cc6c-4b99-8fca-8e31f2d9e7a7', }); }); }); From f114023ad64073c5a4f39652805c78e77b39f76d Mon Sep 17 00:00:00 2001 From: Mrinalini Date: Tue, 23 Jun 2020 12:40:57 -0700 Subject: [PATCH 5/8] updated based on PR comments --- web-api/migrations/00009-document-required-fields.js | 5 ++++- web-api/migrations/00009-document-required-fields.test.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/web-api/migrations/00009-document-required-fields.js b/web-api/migrations/00009-document-required-fields.js index da34abfad13..939a7316b97 100644 --- a/web-api/migrations/00009-document-required-fields.js +++ b/web-api/migrations/00009-document-required-fields.js @@ -1,10 +1,13 @@ const createApplicationContext = require('../src/applicationContext'); +const { + createISODateString, +} = require('../../shared/src/business/utilities/DateHandler'); const { isDocumentRecord, upGenerator } = require('./utilities'); const { isEmpty } = require('lodash'); const applicationContext = createApplicationContext({}); const { Document } = require('../../shared/src/business/entities/Document'); -const DEFAULT_SERVED_AT_DATE = new Date().toISOString(); +const DEFAULT_SERVED_AT_DATE = createISODateString(new Date()); const DEFAULT_SERVED_PARTIES = [ { name: 'Served via migration.', diff --git a/web-api/migrations/00009-document-required-fields.test.js b/web-api/migrations/00009-document-required-fields.test.js index 7048584d0b9..fc6216dee5a 100644 --- a/web-api/migrations/00009-document-required-fields.test.js +++ b/web-api/migrations/00009-document-required-fields.test.js @@ -104,7 +104,7 @@ describe('document required fields test', () => { getStub = jest.fn().mockReturnValue({ promise: async () => ({ - Item: mockItems.scanList, + Item: {}, }), }); From bc6bb7ca3b1e7865cccda54c7ec5eef1263d96ef Mon Sep 17 00:00:00 2001 From: Matt Hopson Date: Tue, 23 Jun 2020 15:05:03 -0600 Subject: [PATCH 6/8] Address PDF review feedback --- .../useCases/addCoversheetInteractor.js | 8 +- .../business/utilities/documentGenerators.js | 34 +++++++-- .../utilities/documentGenerators.test.js | 74 +++++++++++++++++-- .../utilities/htmlGenerator/index.scss | 25 ++++--- .../pdfGenerator/components/AddressLabel.jsx | 3 + .../components/CompressedDocketHeader.jsx | 2 +- .../components/CompressedDocketHeader.test.js | 4 +- .../components/DatePrintedFooter.test.js | 4 +- .../components/DatePrintedFooter.test.jsx | 4 +- .../pdfGenerator/components/DocketHeader.jsx | 2 +- .../components/DocketHeader.test.js | 4 +- .../components/PageMetaHeaderDocket.jsx | 6 +- .../components/PageMetaHeaderDocket.test.js | 2 +- .../components/ReportsMetaHeader.jsx | 4 +- .../documentTemplates/CaseInventoryReport.jsx | 4 +- .../documentTemplates/PendingReport.jsx | 8 +- .../StandingPretrialNotice.jsx | 9 +-- .../StandingPretrialNotice.test.js | 15 ---- .../StandingPretrialOrder.jsx | 12 +-- .../StandingPretrialOrder.test.js | 11 --- .../documentTemplates/TrialCalendar.jsx | 8 +- .../documentTemplates/TrialCalendar.test.js | 2 +- 22 files changed, 145 insertions(+), 100 deletions(-) diff --git a/shared/src/business/useCases/addCoversheetInteractor.js b/shared/src/business/useCases/addCoversheetInteractor.js index 88f66b16fd5..424e7c171ef 100644 --- a/shared/src/business/useCases/addCoversheetInteractor.js +++ b/shared/src/business/useCases/addCoversheetInteractor.js @@ -23,7 +23,7 @@ exports.generateCoverSheetData = ({ (documentEntity.servedAt && applicationContext .getUtilities() - .formatDateString(documentEntity.servedAt, 'MMDDYYYY')) || + .formatDateString(documentEntity.servedAt, 'MMDDYY')) || ''; let dateReceivedFormatted; @@ -33,14 +33,14 @@ 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')) || ''; } @@ -48,7 +48,7 @@ exports.generateCoverSheetData = ({ (documentEntity.filingDate && applicationContext .getUtilities() - .formatDateString(documentEntity.filingDate, 'MMDDYYYY')) || + .formatDateString(documentEntity.filingDate, 'MMDDYY')) || ''; const caseCaptionToUse = useInitialData diff --git a/shared/src/business/utilities/documentGenerators.js b/shared/src/business/utilities/documentGenerators.js index 3192981ba97..776dc1b4e24 100644 --- a/shared/src/business/utilities/documentGenerators.js +++ b/shared/src/business/utilities/documentGenerators.js @@ -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'), }, }); @@ -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'), }, }); @@ -404,7 +404,6 @@ const standingPretrialNotice = async ({ applicationContext, data }) => { const reactStandingPretrialNoticeTemplate = reactTemplateGenerator({ componentName: 'StandingPretrialNotice', data: { - footerDate, options: { caseCaptionExtension, caseTitle, @@ -431,6 +430,16 @@ const standingPretrialNotice = async ({ applicationContext, data }) => { }, }); + let footerHtml = ''; + if (footerDate) { + footerHtml = reactTemplateGenerator({ + componentName: 'DateServedFooter', + data: { + dateServed: footerDate, + }, + }); + } + const pdf = await applicationContext .getUseCases() .generatePdfFromHtmlInteractor({ @@ -438,6 +447,7 @@ const standingPretrialNotice = async ({ applicationContext, data }) => { contentHtml: pdfContentHtml, displayHeaderFooter: true, docketNumber: docketNumberWithSuffix, + footerHtml, headerHtml, overwriteHeader: true, }); @@ -457,7 +467,6 @@ const standingPretrialOrder = async ({ applicationContext, data }) => { const reactStandingPretrialOrderTemplate = reactTemplateGenerator({ componentName: 'StandingPretrialOrder', data: { - footerDate, options: { caseCaptionExtension, caseTitle, @@ -484,6 +493,16 @@ const standingPretrialOrder = async ({ applicationContext, data }) => { }, }); + let footerHtml = ''; + if (footerDate) { + footerHtml = reactTemplateGenerator({ + componentName: 'DateServedFooter', + data: { + dateServed: footerDate, + }, + }); + } + const pdf = await applicationContext .getUseCases() .generatePdfFromHtmlInteractor({ @@ -491,6 +510,7 @@ const standingPretrialOrder = async ({ applicationContext, data }) => { contentHtml: pdfContentHtml, displayHeaderFooter: true, docketNumber: docketNumberWithSuffix, + footerHtml, headerHtml, overwriteHeader: true, }); @@ -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'), }, }); @@ -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'), }, }); @@ -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'), }, }); diff --git a/shared/src/business/utilities/documentGenerators.test.js b/shared/src/business/utilities/documentGenerators.test.js index 88c50665024..e3dbd332534 100644 --- a/shared/src/business/utilities/documentGenerators.test.js +++ b/shared/src/business/utilities/documentGenerators.test.js @@ -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, @@ -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: { @@ -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: `

This is some sample notice text.

+ +

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

+ +

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

`, + 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: { @@ -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

+

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+ +

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

+

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

`, orderTitle: 'ORDER', - signatureText: 'Test Signature', }, }); diff --git a/shared/src/business/utilities/htmlGenerator/index.scss b/shared/src/business/utilities/htmlGenerator/index.scss index e4af36c3ad4..ba0ce4545e5 100644 --- a/shared/src/business/utilities/htmlGenerator/index.scss +++ b/shared/src/business/utilities/htmlGenerator/index.scss @@ -31,7 +31,7 @@ h3 { margin-bottom: 20px; font-family: 'nimbus_roman', serif; font-family: serif; - font-size: 14px; + font-size: 16px; text-align: center; text-decoration: underline; @@ -135,6 +135,10 @@ th { .court-header { margin-bottom: 30px; font-family: serif; + + h1 { + font-size: 16px; + } } .case-information #caption, @@ -274,17 +278,17 @@ th { } .court-address { - font-size: 12px; + font-size: 14px; text-align: center; } @page { - margin: 2cm 1cm; + margin: 1.5cm 1cm 2cm 1cm; size: 8.5in 11in; } @page :first { - margin-top: 1cm; - margin-bottom: 2cm; + margin-top: 0; + margin-bottom: 2.5cm; } .margin-top-0 { @@ -326,7 +330,6 @@ th { .please-change { margin-bottom: 20px; font-size: 14px; - font-weight: 600; } .extra-margin-top { @@ -357,7 +360,7 @@ th { h3 { margin-top: 0; - font-size: 14px; + font-size: 16px; font-weight: normal; text-decoration: none; } @@ -367,7 +370,7 @@ th { #docket-number, #document-title, #certificate-of-service { - font-family: 'nimbus_sans_l', sans-serif !important; + font-family: 'nimbus_roman', serif; } #certificate-of-service { @@ -416,6 +419,10 @@ th { } } +#order-content { + font-size: 14px; +} + .calendar-icon { width: 12px; height: 12px; @@ -429,7 +436,7 @@ th { .docket { position: absolute; - top: 0; + top: 1cm; left: 0; padding-left: 0.6in; } diff --git a/shared/src/business/utilities/pdfGenerator/components/AddressLabel.jsx b/shared/src/business/utilities/pdfGenerator/components/AddressLabel.jsx index fa5cca7d626..4afc561f4ba 100644 --- a/shared/src/business/utilities/pdfGenerator/components/AddressLabel.jsx +++ b/shared/src/business/utilities/pdfGenerator/components/AddressLabel.jsx @@ -12,6 +12,9 @@ export const AddressLabel = ({ }) => { return (
+
{name}
{address1}
{address2 &&
{address2}
} diff --git a/shared/src/business/utilities/pdfGenerator/components/CompressedDocketHeader.jsx b/shared/src/business/utilities/pdfGenerator/components/CompressedDocketHeader.jsx index 6529156cb0d..602904ea251 100644 --- a/shared/src/business/utilities/pdfGenerator/components/CompressedDocketHeader.jsx +++ b/shared/src/business/utilities/pdfGenerator/components/CompressedDocketHeader.jsx @@ -14,7 +14,7 @@ export const CompressedDocketHeader = ({ Revenue, Respondent
- Docket Number {docketNumberWithSuffix} + Docket No. {docketNumberWithSuffix}
{h3 &&

{h3}

} diff --git a/shared/src/business/utilities/pdfGenerator/components/CompressedDocketHeader.test.js b/shared/src/business/utilities/pdfGenerator/components/CompressedDocketHeader.test.js index 4e0171c7c66..929e79c32ea 100644 --- a/shared/src/business/utilities/pdfGenerator/components/CompressedDocketHeader.test.js +++ b/shared/src/business/utilities/pdfGenerator/components/CompressedDocketHeader.test.js @@ -19,9 +19,7 @@ describe('CompressedDocketHeader', () => { let wrapper = shallow( , ); - expect(wrapper.find('#docket-number').text()).toEqual( - 'Docket Number 123-45S', - ); + expect(wrapper.find('#docket-number').text()).toEqual('Docket No. 123-45S'); }); it('only renders an h3 element if h3 prop is provided', () => { diff --git a/shared/src/business/utilities/pdfGenerator/components/DatePrintedFooter.test.js b/shared/src/business/utilities/pdfGenerator/components/DatePrintedFooter.test.js index d2ed537a5b2..f240689b808 100644 --- a/shared/src/business/utilities/pdfGenerator/components/DatePrintedFooter.test.js +++ b/shared/src/business/utilities/pdfGenerator/components/DatePrintedFooter.test.js @@ -4,7 +4,7 @@ const { shallow } = require('enzyme'); describe('DatePrintedFooter', () => { it('renders the given dateServed from props', () => { - let wrapper = shallow(); - expect(wrapper.text()).toContain('Printed 01/01/2020'); + let wrapper = shallow(); + expect(wrapper.text()).toContain('Printed 01/01/20'); }); }); diff --git a/shared/src/business/utilities/pdfGenerator/components/DatePrintedFooter.test.jsx b/shared/src/business/utilities/pdfGenerator/components/DatePrintedFooter.test.jsx index 1ad31361796..f33294d63c5 100644 --- a/shared/src/business/utilities/pdfGenerator/components/DatePrintedFooter.test.jsx +++ b/shared/src/business/utilities/pdfGenerator/components/DatePrintedFooter.test.jsx @@ -4,9 +4,9 @@ const { shallow } = require('enzyme'); describe('DatePrintedFooter', () => { it('renders the date from props', () => { - let wrapper = shallow(); + let wrapper = shallow(); expect(wrapper.find('.date-printed-footer').text()).toEqual( - 'Printed 01/01/2020', + 'Printed 01/01/20', ); }); }); diff --git a/shared/src/business/utilities/pdfGenerator/components/DocketHeader.jsx b/shared/src/business/utilities/pdfGenerator/components/DocketHeader.jsx index ba47de47707..d555045bf3f 100644 --- a/shared/src/business/utilities/pdfGenerator/components/DocketHeader.jsx +++ b/shared/src/business/utilities/pdfGenerator/components/DocketHeader.jsx @@ -16,7 +16,7 @@ export const DocketHeader = ({
Commissioner of Internal Revenue
Respondent
-
Docket Number {docketNumberWithSuffix}
+
Docket No. {docketNumberWithSuffix}
{h3 &&

{h3}

} diff --git a/shared/src/business/utilities/pdfGenerator/components/DocketHeader.test.js b/shared/src/business/utilities/pdfGenerator/components/DocketHeader.test.js index 91fcca811c8..fb86da1cc55 100644 --- a/shared/src/business/utilities/pdfGenerator/components/DocketHeader.test.js +++ b/shared/src/business/utilities/pdfGenerator/components/DocketHeader.test.js @@ -27,9 +27,7 @@ describe('DocketHeader', () => { it('renders the docket number from props', () => { let wrapper = shallow(); - expect(wrapper.find('#docket-number').text()).toEqual( - 'Docket Number 123-45S', - ); + expect(wrapper.find('#docket-number').text()).toEqual('Docket No. 123-45S'); }); it('only renders an h3 element if h3 prop is provided', () => { diff --git a/shared/src/business/utilities/pdfGenerator/components/PageMetaHeaderDocket.jsx b/shared/src/business/utilities/pdfGenerator/components/PageMetaHeaderDocket.jsx index 39b428c99e7..939e685c82a 100644 --- a/shared/src/business/utilities/pdfGenerator/components/PageMetaHeaderDocket.jsx +++ b/shared/src/business/utilities/pdfGenerator/components/PageMetaHeaderDocket.jsx @@ -2,11 +2,11 @@ const React = require('react'); export const PageMetaHeaderDocket = ({ docketNumber }) => { return ( - <> +
- Docket Number: {docketNumber} + Docket No.: {docketNumber}
{ Page of{' '}
- +
); }; diff --git a/shared/src/business/utilities/pdfGenerator/components/PageMetaHeaderDocket.test.js b/shared/src/business/utilities/pdfGenerator/components/PageMetaHeaderDocket.test.js index 1de549d21de..7805a7bbb0b 100644 --- a/shared/src/business/utilities/pdfGenerator/components/PageMetaHeaderDocket.test.js +++ b/shared/src/business/utilities/pdfGenerator/components/PageMetaHeaderDocket.test.js @@ -5,6 +5,6 @@ const { shallow } = require('enzyme'); describe('PageMetaHeaderDocket', () => { it('renders the docket number from props', () => { let wrapper = shallow(); - expect(wrapper.text()).toContain('Docket Number: 123-45'); + expect(wrapper.text()).toContain('Docket No.: 123-45'); }); }); diff --git a/shared/src/business/utilities/pdfGenerator/components/ReportsMetaHeader.jsx b/shared/src/business/utilities/pdfGenerator/components/ReportsMetaHeader.jsx index c3350a20c6c..60bf96d3459 100644 --- a/shared/src/business/utilities/pdfGenerator/components/ReportsMetaHeader.jsx +++ b/shared/src/business/utilities/pdfGenerator/components/ReportsMetaHeader.jsx @@ -2,7 +2,7 @@ const React = require('react'); export const ReportsMetaHeader = ({ headerTitle }) => { return ( - <> +
{ Page of{' '}
- +
); }; diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/CaseInventoryReport.jsx b/shared/src/business/utilities/pdfGenerator/documentTemplates/CaseInventoryReport.jsx index 4946bc93436..64ef7495982 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/CaseInventoryReport.jsx +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/CaseInventoryReport.jsx @@ -17,8 +17,8 @@ export const CaseInventoryReport = ({ - - + + {showStatusColumn && } {showJudgeColumn && } diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/PendingReport.jsx b/shared/src/business/utilities/pdfGenerator/documentTemplates/PendingReport.jsx index 54fec21e74e..5196e8b382f 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/PendingReport.jsx +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/PendingReport.jsx @@ -11,11 +11,11 @@ export const PendingReport = ({ pendingItems, subtitle }) => {
DocketCase titleDocket No.Case TitleCase StatusJudge
- + - - - + + + diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.jsx b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.jsx index 887af65fce0..db01159b196 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.jsx +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.jsx @@ -3,7 +3,7 @@ const React = require('react'); const { DocketHeader } = require('../components/DocketHeader.jsx'); const { PrimaryHeader } = require('../components/PrimaryHeader.jsx'); -export const StandingPretrialNotice = ({ footerDate, options, trialInfo }) => { +export const StandingPretrialNotice = ({ options, trialInfo }) => { return ( <> @@ -115,13 +115,6 @@ export const StandingPretrialNotice = ({ footerDate, options, trialInfo }) => { Trial Judge

-

- Served {footerDate} -

); }; diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.test.js index 496ea0cf8fb..dcaf055d633 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.test.js @@ -5,7 +5,6 @@ import { StandingPretrialNotice } from './StandingPretrialNotice.jsx'; describe('StandingPretrialNotice', () => { let options; let trialInfo; - let footerDate = '05/01/2020'; beforeAll(() => { options = { @@ -113,18 +112,4 @@ describe('StandingPretrialNotice', () => { expect(signature.text()).toContain(`(Signed) ${trialInfo.judge.name}`); }); - - it('renders the served date', () => { - const wrapper = shallow( - , - ); - - const servedStamp = wrapper.find('#served-stamp'); - - expect(servedStamp.text()).toContain(`Served ${footerDate}`); - }); }); diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.jsx b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.jsx index 98ac6ea2f62..bac0578a321 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.jsx +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.jsx @@ -3,7 +3,7 @@ const React = require('react'); const { DocketHeader } = require('../components/DocketHeader.jsx'); const { PrimaryHeader } = require('../components/PrimaryHeader.jsx'); -export const StandingPretrialOrder = ({ footerDate, options, trialInfo }) => { +export const StandingPretrialOrder = ({ options, trialInfo }) => { return ( <> @@ -99,17 +99,7 @@ export const StandingPretrialOrder = ({ footerDate, options, trialInfo }) => { material that is not so stipulated or exchanged, unless the parties have agreed otherwise or the Court so allows for good cause shown.

- - -

- Served {footerDate} -

-

3. Pretrial Memoranda. It is ORDERED that, unless a basis of settlement (resolution of the diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.test.js index 051360c6f92..e9fc784780d 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.test.js @@ -46,15 +46,4 @@ describe('StandingPretrialOrder', () => { expect(wrapper.text()).toContain(trialInfo.state); expect(wrapper.text()).toContain(trialInfo.judge.name); }); - - it('renders a document with a served date', () => { - const wrapper = shallow( - , - ); - expect(wrapper.find('#served-stamp').text()).toEqual('Served 02/02/2020'); - }); }); diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/TrialCalendar.jsx b/shared/src/business/utilities/pdfGenerator/documentTemplates/TrialCalendar.jsx index 1aa03d063d8..e6a58e7940d 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/TrialCalendar.jsx +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/TrialCalendar.jsx @@ -81,16 +81,16 @@ export const TrialCalendar = ({ cases, sessionDetail }) => {

- Open Cases ({cases.length}) + Open cases ({cases.length})

DocketDocket No. Date FiledCase nameFilings and proceedingsCase statusCase NameFilings and ProceedingsCase Status Judge
- + - - + + diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/TrialCalendar.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/TrialCalendar.test.js index 34299eee500..18bf3da1c22 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/TrialCalendar.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/TrialCalendar.test.js @@ -106,7 +106,7 @@ describe('TrialCalendar', () => { ); expect(wrapper.find('#cases-count').text()).toEqual( - `Open Cases (${cases.length})`, + `Open cases (${cases.length})`, ); }); From 3621acb8d2e26bd2ff55e38d39562adb95322070 Mon Sep 17 00:00:00 2001 From: Matt Hopson Date: Tue, 23 Jun 2020 15:25:50 -0600 Subject: [PATCH 7/8] Fix tests --- .../business/useCases/addCoversheetInteractor.js | 2 +- .../useCases/addCoversheetInteractor.test.js | 14 +++++++------- .../documentTemplates/NoticeOfDocketChange.test.js | 2 +- .../NoticeOfReceiptOfPetition.test.js | 2 +- .../pdfGenerator/documentTemplates/Order.test.js | 2 +- .../documentTemplates/ReceiptOfFiling.test.js | 2 +- .../StandingPretrialNotice.test.js | 2 +- .../StandingPretrialOrder.test.js | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/shared/src/business/useCases/addCoversheetInteractor.js b/shared/src/business/useCases/addCoversheetInteractor.js index 424e7c171ef..2c263a8b345 100644 --- a/shared/src/business/useCases/addCoversheetInteractor.js +++ b/shared/src/business/useCases/addCoversheetInteractor.js @@ -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 || '', diff --git a/shared/src/business/useCases/addCoversheetInteractor.test.js b/shared/src/business/useCases/addCoversheetInteractor.test.js index 749d5ea7571..833de703db2 100644 --- a/shared/src/business/useCases/addCoversheetInteractor.test.js +++ b/shared/src/business/useCases/addCoversheetInteractor.test.js @@ -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 () => { @@ -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 () => { @@ -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 () => { @@ -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 () => { @@ -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 () => { @@ -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 () => { @@ -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, '); }); }); diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/NoticeOfDocketChange.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/NoticeOfDocketChange.test.js index f54460610ad..2a796e9f268 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/NoticeOfDocketChange.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/NoticeOfDocketChange.test.js @@ -40,7 +40,7 @@ describe('NoticeOfDocketChange', () => { options.caseCaptionExtension, ); expect(wrapper.find('#docket-number').text()).toEqual( - `Docket Number ${options.docketNumberWithSuffix}`, + `Docket No. ${options.docketNumberWithSuffix}`, ); expect(wrapper.find('h3').at(0).text()).toEqual('Notice of Docket Change'); }); diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/NoticeOfReceiptOfPetition.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/NoticeOfReceiptOfPetition.test.js index 962b368070c..175d0c9c10e 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/NoticeOfReceiptOfPetition.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/NoticeOfReceiptOfPetition.test.js @@ -30,7 +30,7 @@ describe('NoticeOfReceiptOfPetition', () => { expect(wrapper.find('#caption').text()).toContain(caseTitle); expect(wrapper.find('#caption').text()).toContain(caseCaptionExtension); expect(wrapper.find('#docket-number').text()).toEqual( - `Docket Number ${docketNumberWithSuffix}`, + `Docket No. ${docketNumberWithSuffix}`, ); expect(wrapper.find('h3').at(0).text()).toEqual( 'Notice of Receipt of Petition', diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/Order.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/Order.test.js index ce3e5aa4ab7..64206875bcd 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/Order.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/Order.test.js @@ -26,7 +26,7 @@ describe('Order', () => { options.caseCaptionExtension, ); expect(wrapper.find('#docket-number').text()).toEqual( - `Docket Number ${options.docketNumberWithSuffix}`, + `Docket No. ${options.docketNumberWithSuffix}`, ); }); diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/ReceiptOfFiling.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/ReceiptOfFiling.test.js index 06df4fef535..9c883aee68d 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/ReceiptOfFiling.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/ReceiptOfFiling.test.js @@ -57,7 +57,7 @@ describe('ReceiptOfFiling', () => { `${options.caseTitle}, ${options.caseCaptionExtension}`, ); expect(wrapper.find('#docket-number').text()).toEqual( - `Docket Number ${options.docketNumberWithSuffix}`, + `Docket No. ${options.docketNumberWithSuffix}`, ); expect(wrapper.find('.case-information h3').text()).toEqual( 'Receipt of Filing', diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.test.js index dcaf055d633..3b29311bf86 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialNotice.test.js @@ -38,7 +38,7 @@ describe('StandingPretrialNotice', () => { options.caseCaptionExtension, ); expect(wrapper.find('#docket-number').text()).toEqual( - `Docket Number ${options.docketNumberWithSuffix}`, + `Docket No. ${options.docketNumberWithSuffix}`, ); }); diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.test.js b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.test.js index e9fc784780d..5e5e74436c5 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.test.js +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/StandingPretrialOrder.test.js @@ -33,7 +33,7 @@ describe('StandingPretrialOrder', () => { options.caseCaptionExtension, ); expect(wrapper.find('#docket-number').text()).toEqual( - `Docket Number ${options.docketNumberWithSuffix}`, + `Docket No. ${options.docketNumberWithSuffix}`, ); }); From 24face4641166a411bebbd9292d6ccf4de2dfc94 Mon Sep 17 00:00:00 2001 From: Matt Hopson Date: Tue, 23 Jun 2020 16:00:23 -0600 Subject: [PATCH 8/8] Reverse completed message sort --- .../presenter/computeds/formattedMessages.js | 2 +- .../computeds/formattedMessages.test.js | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/web-client/src/presenter/computeds/formattedMessages.js b/web-client/src/presenter/computeds/formattedMessages.js index 490f2361a86..8941cd6b948 100644 --- a/web-client/src/presenter/computeds/formattedMessages.js +++ b/web-client/src/presenter/computeds/formattedMessages.js @@ -25,7 +25,7 @@ export const getFormattedMessages = ({ applicationContext, messages }) => { message => message.isCompleted, ); - completedMessages.sort((a, b) => a.completedAt.localeCompare(b.completedAt)); + completedMessages.sort((a, b) => b.completedAt.localeCompare(a.completedAt)); return { completedMessages, inProgressMessages, messages: formattedMessages }; }; diff --git a/web-client/src/presenter/computeds/formattedMessages.test.js b/web-client/src/presenter/computeds/formattedMessages.test.js index cc68cf9bff1..4cbe1296a4a 100644 --- a/web-client/src/presenter/computeds/formattedMessages.test.js +++ b/web-client/src/presenter/computeds/formattedMessages.test.js @@ -101,21 +101,21 @@ describe('formattedMessages', () => { expect(result.completedMessages).toMatchObject([ { - caseId: '1', - createdAt: '2019-01-01T16:29:13.122Z', + caseId: '2', + createdAt: '2019-01-01T17:29:13.122Z', isCompleted: true, message: 'This is a test message', }, { - caseId: '2', - createdAt: '2019-01-01T17:29:13.122Z', + caseId: '1', + createdAt: '2019-01-01T16:29:13.122Z', isCompleted: true, message: 'This is a test message', }, ]); }); - it('returns completedMessages in order of completedAt', () => { + it('returns completedMessages in descending order of completedAt', () => { const result = getFormattedMessages({ applicationContext, messages: [ @@ -127,14 +127,14 @@ describe('formattedMessages', () => { message: 'This is a test message', }, { - caseId: '3', + caseId: '2', completedAt: '2019-01-01T16:29:13.122Z', // completed first createdAt: '2019-01-02T17:29:13.122Z', isCompleted: true, message: 'This is a test message', }, { - caseId: '2', + caseId: '3', completedAt: '2019-01-02T16:29:13.122Z', // completed second createdAt: '2019-01-01T17:29:13.122Z', isCompleted: true, @@ -145,23 +145,23 @@ describe('formattedMessages', () => { expect(result.completedMessages).toMatchObject([ { - caseId: '3', - completedAt: '2019-01-01T16:29:13.122Z', - createdAt: '2019-01-02T17:29:13.122Z', + caseId: '1', + completedAt: '2019-01-03T16:29:13.122Z', + createdAt: '2019-01-01T16:29:13.122Z', isCompleted: true, message: 'This is a test message', }, { - caseId: '2', + caseId: '3', completedAt: '2019-01-02T16:29:13.122Z', createdAt: '2019-01-01T17:29:13.122Z', isCompleted: true, message: 'This is a test message', }, { - caseId: '1', - completedAt: '2019-01-03T16:29:13.122Z', - createdAt: '2019-01-01T16:29:13.122Z', + caseId: '2', + completedAt: '2019-01-01T16:29:13.122Z', + createdAt: '2019-01-02T17:29:13.122Z', isCompleted: true, message: 'This is a test message', },
Docket no.Docket No. Case TitlePetitioner counselRespondent counselPetitioner CounselRespondent Counsel