Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10489 feedback to test #5649

Merged
merged 10 commits into from
Dec 12, 2024
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 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}`);
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
10 changes: 9 additions & 1 deletion web-api/src/persistence/postgres/utils/migrate/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
10 changes: 9 additions & 1 deletion web-api/src/persistence/postgres/utils/seed/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,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);
});
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
Loading