Skip to content

Commit

Permalink
10489: update court issued document action to use judge full name rat…
Browse files Browse the repository at this point in the history
…her than unused signedByUserId; updated cypress integration test to check for chambers user edge case
  • Loading branch information
TomElliottFlexion committed Dec 12, 2024
1 parent 44a4752 commit 2c50552
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import {
} from '../../../support/statusReportOrder';
import {
loginAsColvin,
loginAsColvinChambers,
loginAsDocketClerk,
} from '../../../../helpers/authentication/login-as-helpers';
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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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',
});
});

Expand Down Expand Up @@ -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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2c50552

Please sign in to comment.