-
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 pull request #5542 from flexion/10460-story
10460 story
- Loading branch information
Showing
39 changed files
with
1,882 additions
and
12 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
68 changes: 68 additions & 0 deletions
68
cypress/local-only/tests/integration/public/trialSessions/trial-sessions.cy.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,68 @@ | ||
import { selectTypeaheadInput } from '../../../../../helpers/components/typeAhead/select-typeahead-input'; | ||
|
||
describe('Public Trial Sessions', () => { | ||
beforeEach(() => { | ||
cy.visit('/trial-sessions'); | ||
}); | ||
|
||
it('should display table filters correctly', () => { | ||
cy.get('[data-testid="proceeding-type-filter"]').should('be.visible'); | ||
cy.get('[data-testid="session-type-filter"]').should('be.visible'); | ||
cy.get('[data-testid="location-filter"]').should('be.visible'); | ||
cy.get('[data-testid="judge-filter"]').should('be.visible'); | ||
|
||
cy.get('[data-testid="remote-proceedings-card"]').should('be.visible'); | ||
cy.get('[data-testid="remote-proceedings-card"]') | ||
.find('a') | ||
.should('have.length', 2); | ||
|
||
cy.get('[data-testid="trial-sessions-reset-filters-button"]').should( | ||
'be.disabled', | ||
); | ||
}); | ||
|
||
it('should enable the reset filters button if there are any filters aplied', () => { | ||
cy.get('[data-testid="trial-sessions-reset-filters-button"]').should( | ||
'be.disabled', | ||
); | ||
|
||
cy.get('[data-testid="In Person-proceeding-label"]').click(); | ||
|
||
cy.get('[data-testid="trial-sessions-reset-filters-button"]').should( | ||
'be.enabled', | ||
); | ||
}); | ||
|
||
it('should display Pill Button for every dropdown filter selected', () => { | ||
const SESSION_TYPE = 'Regular'; | ||
selectTypeaheadInput('sessionTypes-filter-select', SESSION_TYPE); | ||
cy.get(`[data-testid="sessionTypes-${SESSION_TYPE}-pill-button"]`); | ||
|
||
const LOCATION = 'Mobile, Alabama'; | ||
selectTypeaheadInput('locations-filter-select', LOCATION); | ||
cy.get(`[data-testid="locations-${LOCATION}-pill-button"]`); | ||
|
||
const JUDGE = 'Buch'; | ||
selectTypeaheadInput('judges-filter-select', JUDGE); | ||
cy.get(`[data-testid="judges-${JUDGE}-pill-button"]`); | ||
|
||
cy.get(`[data-testid="sessionTypes-${SESSION_TYPE}-pill-button"]`) | ||
.find('button') | ||
.click(); | ||
cy.get(`[data-testid="sessionTypes-${SESSION_TYPE}-pill-button"]`).should( | ||
'not.exist', | ||
); | ||
|
||
cy.get(`[data-testid="locations-${LOCATION}-pill-button"]`) | ||
.find('button') | ||
.click(); | ||
cy.get(`[data-testid="locations-${LOCATION}-pill-button"]`).should( | ||
'not.exist', | ||
); | ||
|
||
cy.get(`[data-testid="judges-${JUDGE}-pill-button"]`) | ||
.find('button') | ||
.click(); | ||
cy.get(`[data-testid="judges-${JUDGE}-pill-button"]`).should('not.exist'); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
shared/src/proxies/trialSessions/getPublicTrialSessionsProxy.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,11 @@ | ||
import { TrialSessionInfoDTO } from '@shared/business/dto/trialSessions/TrialSessionInfoDTO'; | ||
import { get } from '@shared/proxies/requests'; | ||
|
||
export const getPublicTrialSessionsInteractor = ( | ||
applicationContext, | ||
): Promise<TrialSessionInfoDTO[]> => { | ||
return get({ | ||
applicationContext, | ||
endpoint: '/public-api/trial-sessions', | ||
}); | ||
}; |
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,12 @@ | ||
import { RawUser } from '@shared/business/entities/User'; | ||
import { get } from '../requests'; | ||
|
||
export const getPublicUsersInSectionInteractor = ( | ||
applicationContext, | ||
{ section }: { section: string }, | ||
): Promise<RawUser[]> => { | ||
return get({ | ||
applicationContext, | ||
endpoint: `/public-api/sections/${section}/users`, | ||
}); | ||
}; |
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
79 changes: 79 additions & 0 deletions
79
web-api/src/business/useCases/trialSessions/getPublicTrialSessionsInteractor.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,79 @@ | ||
import { applicationContext } from '../../../../../shared/src/business/test/createTestApplicationContext'; | ||
import { getPublicTrialSessionsInteractor } from '@web-api/business/useCases/trialSessions/getPublicTrialSessionsInteractor'; | ||
|
||
describe('getPublicTrialSessionsInteractor', () => { | ||
beforeEach(() => { | ||
applicationContext | ||
.getPersistenceGateway() | ||
.getTrialSessions.mockReturnValue(MOCK_TRIAL_SESSIONS); | ||
}); | ||
|
||
it('should return open trial sessions', async () => { | ||
const result = await getPublicTrialSessionsInteractor(applicationContext); | ||
expect(result.every(session => session.sessionStatus === 'Open')).toBe( | ||
true, | ||
); | ||
}); | ||
}); | ||
|
||
const MOCK_TRIAL_SESSIONS = [ | ||
{ | ||
caseOrder: [], | ||
createdAt: '2019-11-02T05:00:00.000Z', | ||
gsi1pk: 'trial-session-catalog', | ||
isCalendared: true, | ||
judge: { name: 'Cohen', userId: 'dabbad04-18d0-43ec-bafb-654e83405416' }, | ||
maxCases: 30, | ||
pk: 'trial-session|0d943468-bc2e-4631-84e3-b084cf5b1fbb', | ||
proceedingType: 'In Person', | ||
sessionStatus: 'Open', | ||
sessionType: 'Special', | ||
sk: 'trial-session|0d943468-bc2e-4631-84e3-b084cf5b1fbb', | ||
startDate: '2019-12-02T05:00:00.000Z', | ||
startTime: '21:00', | ||
status: 'Closed', | ||
term: 'Fall', | ||
termYear: '2019', | ||
trialLocation: 'Denver, Colorado', | ||
trialSessionId: '0d943468-bc2e-4631-84e3-b084cf5b1fbb', | ||
}, | ||
{ | ||
caseOrder: [], | ||
createdAt: '2020-10-25T05:00:00.000Z', | ||
gsi1pk: 'trial-session-catalog', | ||
isCalendared: true, | ||
judge: { name: 'Colvin', userId: 'dabbad00-18d0-43ec-bafb-654e83405416' }, | ||
maxCases: 100, | ||
pk: 'trial-session|111ac21b-99f9-4321-98c8-b95db00af96b', | ||
proceedingType: 'Remote', | ||
sessionScope: 'Standalone Remote', | ||
sessionStatus: 'Open', | ||
sessionType: 'Special', | ||
sk: 'trial-session|111ac21b-99f9-4321-98c8-b95db00af96b', | ||
startDate: '2020-11-25T05:00:00.000Z', | ||
startTime: '13:00', | ||
term: 'Fall', | ||
termYear: '2020', | ||
trialLocation: 'Standalone Remote', | ||
trialSessionId: '111ac21b-99f9-4321-98c8-b95db00af96b', | ||
}, | ||
{ | ||
caseOrder: [], | ||
createdAt: '2020-10-02T05:00:00.000Z', | ||
gsi1pk: 'trial-session-catalog', | ||
isCalendared: false, | ||
judge: { name: 'Cohen', userId: 'dabbad04-18d0-43ec-bafb-654e83405416' }, | ||
maxCases: 8, | ||
pk: 'trial-session|149159ca-f4a1-4b2b-bc24-bd1fbe6defdc', | ||
proceedingType: 'In Person', | ||
sessionStatus: 'New', | ||
sessionType: 'Regular', | ||
sk: 'trial-session|149159ca-f4a1-4b2b-bc24-bd1fbe6defdc', | ||
startDate: '2020-12-02T05:00:00.000Z', | ||
startTime: '09:00', | ||
term: 'Fall', | ||
termYear: '2020', | ||
trialLocation: 'Birmingham, Alabama', | ||
trialSessionId: '149159ca-f4a1-4b2b-bc24-bd1fbe6defdc', | ||
}, | ||
]; |
18 changes: 18 additions & 0 deletions
18
web-api/src/business/useCases/trialSessions/getPublicTrialSessionsInteractor.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,18 @@ | ||
import { ServerApplicationContext } from '@web-api/applicationContext'; | ||
import { TrialSession } from '@shared/business/entities/trialSessions/TrialSession'; | ||
import { TrialSessionInfoDTO } from '../../../../../shared/src/business/dto/trialSessions/TrialSessionInfoDTO'; | ||
|
||
export const getPublicTrialSessionsInteractor = async ( | ||
applicationContext: ServerApplicationContext, | ||
): Promise<TrialSessionInfoDTO[]> => { | ||
const trialSessions = await applicationContext | ||
.getPersistenceGateway() | ||
.getTrialSessions({ | ||
applicationContext, | ||
}); | ||
|
||
return trialSessions | ||
.map(t => new TrialSession(t).toRawObject()) | ||
.map(trialSession => new TrialSessionInfoDTO(trialSession)) | ||
.filter(trialSession => trialSession.sessionStatus === 'Open'); | ||
}; |
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
7 changes: 7 additions & 0 deletions
7
web-api/src/lambdas/trialSessions/getPublicTrialSessionsLambda.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,7 @@ | ||
import { genericHandler } from '@web-api/genericHandler'; | ||
import { getPublicTrialSessionsInteractor } from '@web-api/business/useCases/trialSessions/getPublicTrialSessionsInteractor'; | ||
|
||
export const getPublicTrialSessionsLambda = event => | ||
genericHandler(event, async ({ applicationContext }) => { | ||
return await getPublicTrialSessionsInteractor(applicationContext); | ||
}); |
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
14 changes: 14 additions & 0 deletions
14
web-client/src/presenter/actions/TrialSession/setTimeStampAction.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,14 @@ | ||
import { DateTime } from 'luxon'; | ||
import { runAction } from '@web-client/presenter/test.cerebral'; | ||
import { setTimeStampAction } from '@web-client/presenter/actions/TrialSession/setTimeStampAction'; | ||
|
||
describe('setTimeStampAction', () => { | ||
it('should set time stamp', async () => { | ||
const propertyName = 'FetchedTrialSessions'; | ||
const result = await runAction(setTimeStampAction({ propertyName }), {}); | ||
|
||
const expectedDate = DateTime.now().setZone('America/New_York').toISODate(); | ||
|
||
expect(result.state[propertyName].toISODate()).toEqual(expectedDate); | ||
}); | ||
}); |
8 changes: 8 additions & 0 deletions
8
web-client/src/presenter/actions/TrialSession/setTimeStampAction.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,8 @@ | ||
import { DateTime } from 'luxon'; | ||
import { state } from '@web-client/presenter/app.cerebral'; | ||
|
||
export const setTimeStampAction = | ||
({ propertyName }: { propertyName: string }) => | ||
({ store }: ActionProps) => { | ||
store.set(state[propertyName], DateTime.now().setZone('America/New_York')); | ||
}; |
18 changes: 18 additions & 0 deletions
18
web-client/src/presenter/actions/resetPublicTrialSessionDataAction.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,18 @@ | ||
import { PublicClientState } from '@web-client/presenter/state-public'; | ||
import { resetPublicTrialSessionDataAction } from '@web-client/presenter/actions/resetPublicTrialSessionDataAction'; | ||
import { runAction } from '@web-client/presenter/test.cerebral'; | ||
|
||
describe('resetPublicTrialSessionDataAction', () => { | ||
it('should reset trial session data', async () => { | ||
const result = await runAction<void, PublicClientState>( | ||
resetPublicTrialSessionDataAction, | ||
{ | ||
state: { | ||
publicTrialSessionData: { id: 123 }, | ||
}, | ||
}, | ||
); | ||
|
||
expect(result.state.publicTrialSessionData).toEqual({}); | ||
}); | ||
}); |
5 changes: 5 additions & 0 deletions
5
web-client/src/presenter/actions/resetPublicTrialSessionDataAction.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,5 @@ | ||
import { state } from '@web-client/presenter/app-public.cerebral'; | ||
|
||
export const resetPublicTrialSessionDataAction = ({ store }: ActionProps) => { | ||
store.set(state.publicTrialSessionData, {}); | ||
}; |
Oops, something went wrong.