generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0a12b8
commit d3ae115
Showing
30 changed files
with
581 additions
and
5 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
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
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,58 @@ | ||
import Page from '../pages/page' | ||
import { Role } from '../../server/enums/role' | ||
import NoCellAllocatedPage from '../pages/NoCellAllocated' | ||
import { prisonerSearchMock } from '../../server/test/mocks/prisonerSearchMock' | ||
|
||
function visitPageWithRoles(roles: string[]) { | ||
cy.setupUserAuth({ | ||
roles, | ||
caseLoads: [ | ||
{ caseloadFunction: '', caseLoadId: 'MDI', currentlyActive: true, description: 'Leeds (HMP)', type: '' }, | ||
], | ||
}) | ||
cy.signIn({ redirectPath: '/establishment-roll/no-cell-allocated' }) | ||
cy.visit('/establishment-roll/no-cell-allocated') | ||
} | ||
context('In reception Page', () => { | ||
beforeEach(() => { | ||
cy.task('reset') | ||
cy.task('stubPostAttributeSearch') | ||
cy.task('stubGetOffenderCellHistory', prisonerSearchMock[0].bookingId) | ||
cy.task('stubGetOffenderCellHistory', prisonerSearchMock[1].bookingId) | ||
cy.task('getUserDetailsList') | ||
}) | ||
|
||
it('Page is visible', () => { | ||
visitPageWithRoles([`ROLE_PRISON`, `ROLE_${Role.GlobalSearch}`]) | ||
|
||
Page.verifyOnPage(NoCellAllocatedPage) | ||
}) | ||
|
||
it('should display a table row for each wing level assignedRollCount', () => { | ||
visitPageWithRoles([`ROLE_PRISON`, `ROLE_${Role.GlobalSearch}`]) | ||
|
||
const page = Page.verifyOnPage(NoCellAllocatedPage) | ||
page.inReceptionRows().should('have.length', 2) | ||
|
||
page.inReceptionRows().first().find('td').eq(1).should('contain.text', 'Shannon, Eddie') | ||
page.inReceptionRows().first().find('td').eq(2).should('contain.text', 'A1234AB') | ||
page.inReceptionRows().first().find('td').eq(3).should('contain.text', '1-1-2') | ||
page.inReceptionRows().first().find('td').eq(4).should('contain.text', '00:00') | ||
page.inReceptionRows().first().find('td').eq(5).should('contain.text', 'Edwin Shannon') | ||
}) | ||
|
||
it('should display allocation link if user has cell move', () => { | ||
visitPageWithRoles([`ROLE_PRISON`, `ROLE_${Role.GlobalSearch}`, `ROLE_${Role.CellMove}`]) | ||
|
||
const page = Page.verifyOnPage(NoCellAllocatedPage) | ||
page.inReceptionRows().should('have.length', 2) | ||
|
||
page | ||
.inReceptionRows() | ||
.first() | ||
.find('td') | ||
.eq(6) | ||
.find('a[href="http://localhost:3002/prisoner/A1234AB/cell-move/search-for-cell"]') | ||
.should('contain.text', 'Allocate cell') | ||
}) | ||
}) |
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
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,9 @@ | ||
import Page, { PageElement } from './page' | ||
|
||
export default class NoCellAllocatedPage extends Page { | ||
constructor() { | ||
super('No cell allocated') | ||
} | ||
|
||
inReceptionRows = (): PageElement => cy.get('table.unallocated-roll__table tbody tr') | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export interface BedAssignment { | ||
bookingId: number | ||
livingUnitId: number | ||
assignmentDate: string | ||
assignmentReason: string | ||
assignmentEndDate: string | ||
assignmentEndDateTime: string | ||
agencyId: string | ||
description: string | ||
bedAssignmentHistorySequence: number | ||
movementMadeBy: string | ||
offenderNo: string | ||
} |
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,28 @@ | ||
export interface PagedList<T> { | ||
content: T[] | ||
pageable?: { | ||
sort: { | ||
empty: boolean | ||
sorted: boolean | ||
unsorted: boolean | ||
} | ||
offset: number | ||
pageSize: number | ||
pageNumber: number | ||
paged: boolean | ||
unpaged: boolean | ||
} | ||
totalPages: number | ||
last: boolean | ||
totalElements: number | ||
size: number | ||
number: number | ||
sort: { | ||
empty: boolean | ||
sorted: boolean | ||
unsorted: boolean | ||
} | ||
first: boolean | ||
numberOfElements: number | ||
empty: boolean | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { Prisoner } from './prisoner' | ||
import { PagedList } from './pagedList' | ||
|
||
export interface PrisonerSearchClient { | ||
getPrisonersById(prisonerNumbers: string[]): Promise<Prisoner[]> | ||
getCswapPrisonersInEstablishment(prisonId: string): Promise<PagedList<Prisoner>> | ||
} |
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 @@ | ||
export interface UserDetail { | ||
staffId: number | ||
username: string | ||
firstName: string | ||
lastName: string | ||
thumbnailId?: number | ||
activeCaseLoadId?: string | ||
accountStatus: 'ACTIVE' | 'INACT' | 'SUS' | 'CAREER' | 'MAT' | 'SAB' | 'SICK' | ||
lockDate: string | ||
expiryDate?: string | ||
lockedFlag?: boolean | ||
expiredFlag?: boolean | ||
active: boolean | ||
} |
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
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
Oops, something went wrong.