-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '10522-story' into 1522-test
- Loading branch information
Showing
4 changed files
with
124 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...c/business/useCases/trialSessions/generateNoticeOfChangeOfTrialLocationInteractor.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { RawTrialSession } from '@shared/business/entities/trialSessions/TrialSession'; | ||
import { applicationContext } from '@shared/business/test/createTestApplicationContext'; | ||
import { generateNoticeOfChangeOfTrialLocationInteractor } from '@web-api/business/useCases/trialSessions/generateNoticeOfChangeOfTrialLocationInteractor'; | ||
|
||
describe('generateNoticeOfChangeOfTrialLocationInteractor', () => { | ||
const TEST_DOCKET_NUMBER = 'TEST_DOCKET_NUMBER'; | ||
const MOCKED_CASE = { | ||
caseCaption: | ||
'Virginia Vincent, Deceased, Virginia Vincent, Surviving Spouse, Petitioner', | ||
docketNumber: TEST_DOCKET_NUMBER, | ||
} as RawCase; | ||
|
||
const MOCK_ARRAY_BUFFER = 'MOCK_ARRAY_BUFFER'; | ||
|
||
beforeEach(() => { | ||
applicationContext | ||
.getPersistenceGateway() | ||
.getCaseByDocketNumber.mockReturnValue(MOCKED_CASE); | ||
|
||
applicationContext | ||
.getDocumentGenerators() | ||
.noticeOfChangeOfTrialLocation.mockReturnValue(MOCK_ARRAY_BUFFER); | ||
}); | ||
|
||
it('should call the generatePDF method with correct params', async () => { | ||
const PREVIOUS_TRIAL_SESSION = { | ||
trialSessionId: 'PREVIOUS', | ||
} as RawTrialSession; | ||
const UPDATED_TRIAL_SESSION = { | ||
trialSessionId: 'UPDATED', | ||
} as RawTrialSession; | ||
|
||
const results = await generateNoticeOfChangeOfTrialLocationInteractor( | ||
applicationContext, | ||
{ | ||
docketNumber: TEST_DOCKET_NUMBER, | ||
previousTrialSession: PREVIOUS_TRIAL_SESSION, | ||
updatedTrialSession: UPDATED_TRIAL_SESSION, | ||
}, | ||
); | ||
|
||
expect(results).toEqual(MOCK_ARRAY_BUFFER); | ||
|
||
const getCaseByDocketNumberCalls = | ||
applicationContext.getPersistenceGateway().getCaseByDocketNumber.mock | ||
.calls; | ||
expect(getCaseByDocketNumberCalls.length).toEqual(1); | ||
expect(getCaseByDocketNumberCalls[0][0].docketNumber).toEqual( | ||
TEST_DOCKET_NUMBER, | ||
); | ||
|
||
const noticeOfChangeOfTrialLocationCalls = | ||
applicationContext.getDocumentGenerators().noticeOfChangeOfTrialLocation | ||
.mock.calls; | ||
expect(noticeOfChangeOfTrialLocationCalls.length).toEqual(1); | ||
expect(noticeOfChangeOfTrialLocationCalls[0][0].data).toEqual({ | ||
caseCaptionExtension: 'Petitioner', | ||
caseTitle: | ||
'Virginia Vincent, Deceased, Virginia Vincent, Surviving Spouse', | ||
docketNumberWithSuffix: undefined, | ||
previousTrialSession: PREVIOUS_TRIAL_SESSION, | ||
updatedTrialSession: UPDATED_TRIAL_SESSION, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters