Skip to content

Commit

Permalink
Merge pull request #5331 from flexion/10339-test-feedback
Browse files Browse the repository at this point in the history
10339: test - feedback
  • Loading branch information
nechama-krigsman committed Sep 5, 2024
2 parents 3d438e1 + ee9b29b commit 0503fe3
Show file tree
Hide file tree
Showing 28 changed files with 395 additions and 176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,15 @@ describe('File a petition', () => {
"Petitioner's contact information: John Cruz 123 Test Drive Boulder, CO 12345 Phone: Test Phone",
);
expect(text).to.include(
"Counsel's contact information: Test Private Practitioner Bogus Barristers 234 Main St Apartment 4 Under the stairs Chicago, IL 61234 +1 (555) 555-5555 [email protected] Tax Court Bar No.: PT5432",
"Counsel's contact information: Test Private Practitioner Bogus Barristers 234 Main St Apartment 4 Under the stairs Chicago, IL 61234 Phone: +1 (555) 555-5555 Email: [email protected] Tax Court Bar No.: PT5432",
);
expect(text).not.to.include('Service Email');
expect(text).not.to.include(
'Register for electronic filing and service',
);
},
);
});

// should not display Service Email
// should not display Register for electronic filing and service:
// should display counsel contact information
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
);
});

it('should not display email field', () => {
cy.get('[data-testid="filing-type-0"]').click();
cy.get('[data-testid="contact-primary-paper-petition-email"]').should(
'not.exist',
);
});
it('should display validation error messages to all required fields left empty', () => {
const ERROR_MESSAGES_DATA_TEST_ID = [
'primary-contact-name-error-message',
Expand Down Expand Up @@ -201,6 +207,12 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
'Petitioner’s full name',
);
});
it('should display email field', () => {
cy.get('[data-testid="filing-type-0"]').click();
cy.get('[data-testid="contact-primary-paper-petition-email"]').should(
'exist',
);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -687,21 +687,28 @@ describe('File a petition: Step 1 - Petitioner Information', () => {
});

describe('Practitioner', () => {
beforeEach(() => {
loginAsPrivatePractitioner();
cy.visit('/file-a-petition/new');
cy.get('[data-testid="step-indicator-current-step-1-icon"]');
cy.get('[data-testid="filing-type-3"').click();
});
describe('Other', () => {
describe('A minor or legally incompetent person', () => {
it('should display correct other type title', () => {
cy.get('[data-testid="other-type-radio-option-1"]').click();
cy.get('[data-testid="estate-type-legend"]').should(
'have.text',
'What is the petitioner’s role in filing for this minor or legally incompetent person?',
);
});
describe('Other Filing Options', () => {
it('should display other filing options', () => {
loginAsPrivatePractitioner();
cy.visit('/file-a-petition/new');
cy.get('[data-testid="filing-type-3"').click();

cy.get('[data-testid="other-type-radio-option-0"]').should(
'have.text',
'An estate or trust',
);
cy.get('[data-testid="other-type-radio-option-1"]').should(
'have.text',
'Donor',
);
cy.get('[data-testid="other-type-radio-option-2"]').should(
'have.text',
'Transferee',
);
cy.get('[data-testid="other-type-radio-option-3"]').should(
'have.text',
'Deceased Spouse',
);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BusinessContact } from './BusinessContact';
import { CONTACT_TYPES, PARTY_TYPES } from '../EntityConstants';
import { CONTACT_TYPES, FilingType, PARTY_TYPES } from '../EntityConstants';
import { ContactUpdated } from '@shared/business/entities/contacts/ContactUpdated';
import { DeceasedSpouseContact } from '@shared/business/entities/contacts/DeceasedSpouseContact';
import { OtherContact } from '@shared/business/entities/contacts/OtherContact';
Expand All @@ -15,7 +15,7 @@ export function ContactFactoryUpdated({
}: {
contactInfoPrimary: {};
contactInfoSecondary: {};
filingType: string;
filingType: FilingType;
partyType: string;
petitionType: string;
hasSpouseConsent: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface Contact {
address2?: string;
address3?: string;
city: string;
paperPetitionEmail?: string;
postalCode: string;
phone: string;
state: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ export const Petition = ({
<b>Phone: </b>
{contactPrimary.phone}
</div>
{!isPetitioner && (
<div>
<b>Email: </b>
{contactPrimary.paperPetitionEmail || 'Email not provided'}
</div>
)}
{contactPrimary.placeOfLegalResidence && (
<div>
{BUSINESS_TYPE_VALUES.includes(partyType) ? (
Expand Down Expand Up @@ -288,8 +294,14 @@ export const Petition = ({
{contactCounsel.city}, {contactCounsel.state}{' '}
{contactCounsel.postalCode}
</div>
<div>{contactCounsel.phone}</div>
<div>{contactCounsel.email}</div>
<div>
<b>Phone: </b>
{contactCounsel.phone}
</div>
<div>
<b>Email: </b>
{contactCounsel.email}
</div>

<div>
<b>Tax Court Bar No.: </b>
Expand Down
7 changes: 4 additions & 3 deletions web-api/src/business/useCases/createCaseInteractor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ describe('createCaseInteractor', () => {
stinFile: new File([], 'test.pdf'),
stinFileSize: 1,
},
stinFileId: '96759830-8970-486f-916b-23439a8ebb70',
stinFileId: '413f62ce-7c8d-446e-aeda-14a2a625a611',
},
user,
);
Expand Down Expand Up @@ -398,7 +398,7 @@ describe('createCaseInteractor', () => {
stinFile: new File([], 'test.pdf'),
stinFileSize: 1,
},
stinFileId: '96759830-8970-486f-916b-23439a8ebb70',
stinFileId: '413f62ce-7c8d-446e-aeda-14a2a625a611',
},
user,
);
Expand Down Expand Up @@ -548,7 +548,7 @@ describe('createCaseInteractor', () => {
});
});

it('should set serviceIndicator to none for petitioner when case is created by a private petitioner', async () => {
it('should remove email and serviceIndicator for petitioner when case is created by a private petitioner', async () => {
user = new PrivatePractitioner({
barNumber: 'BN1234',
email: '[email protected]',
Expand Down Expand Up @@ -594,6 +594,7 @@ describe('createCaseInteractor', () => {

result.petitioners.forEach(p => {
expect(p.serviceIndicator).toBe(SERVICE_INDICATOR_TYPES.SI_NONE);
expect(p.email).toBeUndefined();
});
});
});
4 changes: 3 additions & 1 deletion web-api/src/business/useCases/createCaseInteractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ export const createCaseInteractor = async (
);
}

// remove the email from contactPrimary since the practitioners array should have a service email
// remove the email from contactPrimary
// since the practitioners array should have a service email
// and paperPetitionEmail is used as email for the petitioner
delete petitionEntity.getContactPrimary().email;
delete petitionEntity.getContactPrimary().serviceIndicator;

Expand Down
57 changes: 47 additions & 10 deletions web-client/src/presenter/actions/formatPetitionAction.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
CASE_TYPES_MAP,
ROLES,
} from '@shared/business/entities/EntityConstants';
import { CASE_TYPES_MAP } from '@shared/business/entities/EntityConstants';
import { applicationContextForClient as applicationContext } from '@web-client/test/createClientTestApplicationContext';
import { formatPetitionAction } from '@web-client/presenter/actions/formatPetitionAction';
import { mockPetitionerUser } from '@shared/test/mockAuthUsers';
import {
mockPetitionerUser,
mockPrivatePractitionerUser,
} from '@shared/test/mockAuthUsers';
import { presenter } from '../presenter-mock';
import { runAction } from '@web-client/presenter/test.cerebral';

Expand Down Expand Up @@ -170,6 +170,7 @@ describe('formatPetitionAction', () => {
state: {
petitionFormatted: undefined,
user: {
...mockPrivatePractitionerUser,
barNumber: 'TEST_barNumber',
contact: {
address1: 'TEST_address1',
Expand All @@ -180,10 +181,7 @@ describe('formatPetitionAction', () => {
postalCode: 'TEST_postalCode',
state: 'TEST_state',
},
email: TEST_EMAIL,
firmName: 'TEST_firmName',
name: 'TEST_Name',
role: ROLES.privatePractitioner,
},
},
});
Expand All @@ -194,12 +192,51 @@ describe('formatPetitionAction', () => {
address3: 'TEST_address3',
barNumber: 'TEST_barNumber',
city: 'TEST_city',
email: 'TEST_EMAIL',
email: '[email protected]',
firmName: 'TEST_firmName',
name: 'TEST_Name',
name: 'Reginald Barclay',
phone: 'TEST_phone',
postalCode: 'TEST_postalCode',
state: 'TEST_state',
});
});

it('should set primary contact email to user email when the user is a petitioner', async () => {
const results = await runAction(formatPetitionAction, {
modules: {
presenter,
},
props: PROPS,
state: {
petitionFormatted: undefined,
user: mockPetitionerUser,
},
});

expect(results.state.petitionFormatted?.contactPrimary?.email).toEqual(
'[email protected]',
);
});

it('should not set primary contact email to user email when the user is a private practitioner', async () => {
const results = await runAction(formatPetitionAction, {
modules: {
presenter,
},
props: {
...PROPS,
createPetitionStep1Data: {
contactPrimary: { email: '[email protected]' },
},
},
state: {
petitionFormatted: undefined,
user: mockPrivatePractitionerUser,
},
});

expect(results.state.petitionFormatted?.contactPrimary?.email).toEqual(
'[email protected]',
);
});
});
1 change: 1 addition & 0 deletions web-client/src/presenter/actions/formatPetitionAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const formatPetitionAction = ({
const { contactPrimary, irsNotices } = petitionInfo;

const user = get(state.user);

contactPrimary.email = user.email;

const irsNoticesWithCaseTypes = irsNotices.map(irsNotice => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PETITION_TYPES } from '@shared/business/entities/EntityConstants';
import { applicationContextForClient as applicationContext } from '@web-client/test/createClientTestApplicationContext';
import { mockPetitionerUser } from '@shared/test/mockAuthUsers';
import { presenter } from '@web-client/presenter/presenter-mock';
import { runAction } from '@web-client/presenter/test.cerebral';
import { saveAndSubmitCaseAction } from '@web-client/presenter/actions/saveAndSubmitCaseAction';
Expand Down Expand Up @@ -68,6 +69,7 @@ describe('saveAndSubmitCaseAction', () => {
petitionFormatted: 'petitionFormattedData',
petitionType: PETITION_TYPES.userUploaded,
},
user: mockPetitionerUser,
},
});

Expand Down Expand Up @@ -150,6 +152,7 @@ describe('saveAndSubmitCaseAction', () => {
petitionFormatted: 'petitionFormattedData',
petitionType: PETITION_TYPES.autoGenerated,
},
user: mockPetitionerUser,
},
});

Expand Down Expand Up @@ -234,6 +237,7 @@ describe('saveAndSubmitCaseAction', () => {
petitionFormatted: 'petitionFormattedData',
petitionType: PETITION_TYPES.autoGenerated,
},
user: mockPetitionerUser,
},
});

Expand Down
10 changes: 7 additions & 3 deletions web-client/src/presenter/actions/saveAndSubmitCaseAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
FileUploadProgressType,
FileUploadProgressValueType,
PETITION_TYPES,
ROLES,
} from '@shared/business/entities/EntityConstants';
import { state } from '@web-client/presenter/app.cerebral';

Expand Down Expand Up @@ -82,11 +83,14 @@ export const saveAndSubmitCaseAction = async ({

await Promise.all(documentsThatNeedCoverSheet.map(addCoversheet));

const isPetitioner = user.role === ROLES.petitioner;
const successTitle = `${isPetitioner ? 'Your' : 'The'} case has been assigned docket number ${caseDetail.docketNumberWithSuffix || caseDetail.docketNumber}`;
const successMessage = `${isPetitioner ? 'Your' : 'The'} case has been created and ${isPetitioner ? 'your' : ''} documents sent to the U.S. Tax Court.`;

return path.success({
alertSuccess: {
message:
'Your case has been created and your documents sent to the U.S. Tax Court.',
title: `Your case has been assigned docket number ${caseDetail.docketNumberWithSuffix || caseDetail.docketNumber}`,
message: successMessage,
title: successTitle,
},
caseDetail,
});
Expand Down
Loading

0 comments on commit 0503fe3

Please sign in to comment.