From 328ccd9ceeadd92ff25ce829577b641ecdaa1135 Mon Sep 17 00:00:00 2001 From: Javis Sullivan Date: Mon, 9 Dec 2024 11:11:04 -0500 Subject: [PATCH 1/3] bug-fix: add explicit process exits on promise success --- .../src/persistence/postgres/utils/migrate/migrate.ts | 10 +++++++++- web-api/src/persistence/postgres/utils/seed/seed.ts | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/web-api/src/persistence/postgres/utils/migrate/migrate.ts b/web-api/src/persistence/postgres/utils/migrate/migrate.ts index 823beb2a723..1e40747943a 100644 --- a/web-api/src/persistence/postgres/utils/migrate/migrate.ts +++ b/web-api/src/persistence/postgres/utils/migrate/migrate.ts @@ -36,4 +36,12 @@ async function migrateToLatest() { }); } -migrateToLatest().catch; +migrateToLatest() + .then(() => { + console.log('Postgres migration completed Successfully!'); + process.exit(0); + }) + .catch(err => { + console.log('Migration failed.'); + console.log(err); + }); diff --git a/web-api/src/persistence/postgres/utils/seed/seed.ts b/web-api/src/persistence/postgres/utils/seed/seed.ts index e716873b12a..931b3315d61 100644 --- a/web-api/src/persistence/postgres/utils/seed/seed.ts +++ b/web-api/src/persistence/postgres/utils/seed/seed.ts @@ -11,4 +11,12 @@ export const seed = async () => { ); }; -seed().catch; +seed() + .then(() => { + console.log('Database data seeded successfully!'); + process.exit(0); + }) + .catch(err => { + console.log('Could not seed postgres data.'); + console.log(err); + }); From 2c505528556f2f3ec2fc34f5ada79d60038c922a Mon Sep 17 00:00:00 2001 From: TomElliottFlexion <66225176+TomElliottFlexion@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:58:10 -0600 Subject: [PATCH 2/3] 10489: update court issued document action to use judge full name rather than unused signedByUserId; updated cypress integration test to check for chambers user edge case --- ...atus-report-order-description-fields.cy.ts | 37 +++++++++++++++++-- ...urtIssuedDocumentInitialDataAction.test.ts | 28 +++++++++++--- ...setCourtIssuedDocumentInitialDataAction.ts | 7 +++- 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts index d07e42b1d12..0fbe8225eb2 100644 --- a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -8,6 +8,7 @@ import { } from '../../../support/statusReportOrder'; import { loginAsColvin, + loginAsColvinChambers, loginAsDocketClerk, } from '../../../../helpers/authentication/login-as-helpers'; import { logout } from '../../../../helpers/authentication/logout'; @@ -15,7 +16,7 @@ import { logout } from '../../../../helpers/authentication/logout'; describe('should default status report order descriptions', () => { const today = formatNow(FORMATS.MMDDYYYY); it('should display default description when document type is an Order', () => { - judgeCreatesAndSavesStatusReportOrder(today); + judgeOrChambersCreatesStatusReportOrder(today); loginAsDocketClerk(); cy.visit(`/case-detail/${docketNumber}`); cy.get('#tab-drafts').click(); @@ -31,8 +32,31 @@ describe('should default status report order descriptions', () => { `Docket entry preview: Order parties by ${today} shall file a status report.`, ); }); + it('should set event code to OJR when case is stricken from trial session and jurisdiction is retained and display default description', () => { - judgeCreatesAndSavesStatusReportOrder(today, true); + judgeOrChambersCreatesStatusReportOrder(today, true); + loginAsDocketClerk(); + cy.visit(`/case-detail/${docketNumber}`); + cy.get('#tab-drafts').click(); + getLastDraftOrderElementFromDrafts().click(); + cy.get('[data-testid="add-court-issued-docket-entry-button"]').click(); + cy.get('.select-react-element__control').should( + 'have.text', + 'Order that jurisdiction is retained', + ); + cy.get('[data-testid="document-description-input"]').should( + 'have.value', + `. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, + ); + cy.get('[data-testid="judge-select"]').should('have.value', 'Colvin'); + cy.get('[data-testid="docket-entry-preview-text"]').should( + 'have.text', + `Docket entry preview: Order that jurisdiction is retained by Judge Colvin. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, + ); + }); + + it('should set event code to OJR when case is stricken from trial session and jurisdiction is retained and display default description', () => { + judgeOrChambersCreatesStatusReportOrder(today, true, true); loginAsDocketClerk(); cy.visit(`/case-detail/${docketNumber}`); cy.get('#tab-drafts').click(); @@ -54,11 +78,16 @@ describe('should default status report order descriptions', () => { }); }); -function judgeCreatesAndSavesStatusReportOrder( +function judgeOrChambersCreatesStatusReportOrder( today: string, jurisdictionRetained: boolean = false, + chambersUser: boolean = false, ) { - loginAsColvin(); + if (chambersUser) { + loginAsColvinChambers(); + } else { + loginAsColvin(); + } cy.visit(`/case-detail/${docketNumber}`); cy.get('#tab-document-view').click(); cy.contains('Status Report').click(); diff --git a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts index 98398ba3e31..5011bcd8f7c 100644 --- a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts +++ b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts @@ -9,6 +9,7 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { 'ddfd978d-6be6-4877-b004-2b5735a41fee', '11597d22-0874-4c5e-ac98-a843d1472baf', '22597d22-0874-4c5e-ac98-a843d1472baf', + '43737877-0874-4c5e-ac98-dhd83838887j', ]; beforeAll(() => { @@ -27,6 +28,13 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { docketEntryId: docketEntryIds[2], eventCode: 'OJR', signedByUserId: '4497d22-0874-4c5e-ac98-a843d1472baf', + signedJudgeName: 'John O. Colvin', + }); + MOCK_CASE.docketEntries.push({ + docketEntryId: docketEntryIds[3], + eventCode: 'OJR', + signedByUserId: 'not-colvins-id', + signedJudgeName: 'John O. Colvin', }); }); @@ -121,35 +129,43 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { presenter, }, props: { - docketEntryId: '22597d22-0874-4c5e-ac98-a843d1472baf', + docketEntryId: docketEntryIds[2], }, state: { caseDetail: MOCK_CASE, form: {}, judges: [ - { name: 'Colvin', userId: '4497d22-0874-4c5e-ac98-a843d1472baf' }, + { + judgeFullName: 'John O. Colvin', + name: 'Colvin', + userId: '4497d22-0874-4c5e-ac98-a843d1472baf', + }, ], }, }); expect(result.state.form.judge).toEqual('Colvin'); }); - it('should not set the judge name when eventcode is OJR and docketEntry was signed by a non judge user', async () => { + it('should set the judge name when eventcode is OJR and docketEntry was signed by a non judge user', async () => { const result = await runAction(setCourtIssuedDocumentInitialDataAction, { modules: { presenter, }, props: { - docketEntryId: '22597d22-0874-4c5e-ac98-a843d1472baf', + docketEntryId: docketEntryIds[3], }, state: { caseDetail: MOCK_CASE, form: {}, judges: [ - { name: 'Cohen', userId: '3297d22-0874-4c5e-ac98-a843d1472baf' }, + { + judgeFullName: 'John O. Colvin', + name: 'Colvin', + userId: '4497d22-0874-4c5e-ac98-a843d1472baf', + }, ], }, }); - expect(result.state.form.judge).toEqual(undefined); + expect(result.state.form.judge).toEqual('Colvin'); }); }); diff --git a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts index 0fbd5c9596a..92e9db0309a 100644 --- a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts +++ b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts @@ -38,8 +38,13 @@ export const setCourtIssuedDocumentInitialDataAction = ({ if (docketEntry.eventCode === 'OJR') { const signingJudge = judges.find(judge => { - return judge.userId === docketEntry.signedByUserId; + return ( + judge.judgeFullName && + docketEntry.signedJudgeName && + judge.judgeFullName === docketEntry.signedJudgeName + ); }); + if (signingJudge) { store.set(state.form.judge, signingJudge.name); } From 1270678db073248ab45c33f4cb0e53c510c263a4 Mon Sep 17 00:00:00 2001 From: TomElliottFlexion <66225176+TomElliottFlexion@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:00:42 -0600 Subject: [PATCH 3/3] 10489: update cypress test description --- .../status-report-order-description-fields.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts index 0fbe8225eb2..05c61b03f62 100644 --- a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -55,7 +55,7 @@ describe('should default status report order descriptions', () => { ); }); - it('should set event code to OJR when case is stricken from trial session and jurisdiction is retained and display default description', () => { + it('should continue to handle OJR and set correct signing judge when status order report is signed by chambers user', () => { judgeOrChambersCreatesStatusReportOrder(today, true, true); loginAsDocketClerk(); cy.visit(`/case-detail/${docketNumber}`);