Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ministryofjustice/hmpps-temporary-accommodation-ui
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8711fe6d7686bf9441445e0cb4d5f947ed6c403f
Choose a base ref
..
head repository: ministryofjustice/hmpps-temporary-accommodation-ui
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0bc63770b27aa32089c644d5725735eb3c78207f
Choose a head ref
Showing with 705 additions and 788 deletions.
  1. +8 −8 .github/workflows/ci.yml
  2. +1 −1 .github/workflows/codeql.yml
  3. +1 −1 .github/workflows/generate-types.yml
  4. +17 −0 cypress_shared/components/bedspaceSearchResult.ts
  5. +1 −1 cypress_shared/pages/page.ts
  6. +1 −2 docker-compose-test.yml
  7. +1 −2 docker-compose.yml
  8. +1 −1 e2e/tests/stepDefinitions/manage/departure.ts
  9. +4 −2 integration_tests/mockApis/report.ts
  10. +1 −1 integration_tests/tests/temporary-accommodation/manage/bedspaceSearch.cy.ts
  11. +0 −34 integration_tests/tests/temporary-accommodation/manage/report.cy.ts
  12. +96 −83 package-lock.json
  13. +5 −5 package.json
  14. +0 −2 server/@types/shared/index.d.ts
  15. +1 −1 server/@types/shared/models/ApprovedPremisesUserPermission.ts
  16. +1 −1 server/@types/shared/models/Cas3ReportType.ts
  17. +1 −1 server/@types/shared/models/MigrationJobType.ts
  18. +0 −9 server/@types/shared/models/NewCas1Arrival.ts
  19. +0 −10 server/@types/shared/models/NewNonarrival.ts
  20. +2 −1 server/@types/shared/models/ReferralHistoryNoteMessageDetails.ts
  21. +1 −1 server/@types/shared/models/SeedFileType.ts
  22. +1 −5 server/@types/shared/models/TemporaryAccommodationBedSearchParameters.ts
  23. +3 −0 server/@types/shared/models/TemporaryAccommodationBedSearchResultOverlap.ts
  24. +1 −1 server/@types/shared/models/TimelineEventType.ts
  25. +6 −0 server/@types/shared/models/UserWithWorkload.ts
  26. +0 −22 server/data/bookingClient.test.ts
  27. +0 −9 server/data/bookingClient.ts
  28. +78 −78 server/data/reportClient.test.ts
  29. +0 −9 server/data/reportClient.ts
  30. +34 −41 server/data/restClient.test.ts
  31. +33 −18 server/data/restClient.ts
  32. +2 −0 server/paths/api.ts
  33. +1 −2 server/paths/temporary-accommodation/manage.ts
  34. +0 −3 server/routes/temporary-accommodation/manage.ts
  35. +0 −4 server/services/index.ts
  36. +0 −40 server/services/nonArrivalService.test.ts
  37. +0 −20 server/services/nonArrivalService.ts
  38. +1 −16 server/services/reportService.test.ts
  39. +1 −9 server/services/reportService.ts
  40. +1 −0 server/testutils/factories/bedSearchResult.ts
  41. +0 −2 server/testutils/factories/index.ts
  42. +0 −15 server/testutils/factories/nonArrival.ts
  43. +1 −0 server/testutils/factories/overlap.ts
  44. +2 −0 server/utils/nunjucksSetup.ts
  45. +58 −2 server/utils/reportUtils.test.ts
  46. +12 −3 server/utils/reportUtils.ts
  47. +16 −1 server/utils/viewUtils.test.ts
  48. +12 −0 server/utils/viewUtils.ts
  49. +34 −39 server/views/applications/full.njk
  50. +50 −49 server/views/applications/pages/check-your-answers/check-your-answers/review.njk
  51. +1 −1 server/views/applications/people/confirm.njk
  52. +100 −87 server/views/components/person-details/macro.njk
  53. +28 −30 server/views/temporary-accommodation/assessments/full.njk
  54. +78 −76 server/views/temporary-accommodation/assessments/summary.njk
  55. +8 −1 server/views/temporary-accommodation/bedspace-search/results.njk
  56. +0 −36 wiremock/nonArrivalStubs.ts
  57. +0 −2 wiremock/stubApis.ts
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2

- name: Setup Node.js environment
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version-file: '.node-version'
cache: 'npm'
@@ -36,10 +36,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2

- name: Setup Node.js environment
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version-file: '.node-version'
cache: 'npm'
@@ -58,10 +58,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2

- name: Setup Node.js environment
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version-file: '.node-version'
cache: 'npm'
@@ -77,10 +77,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2

- name: Setup Node.js environment
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version-file: '.node-version'
cache: 'npm'
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
2 changes: 1 addition & 1 deletion .github/workflows/generate-types.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Check out code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2
- name: Generate Types
run: ./script/generate-types
- name: Create Pull Request
17 changes: 17 additions & 0 deletions cypress_shared/components/bedspaceSearchResult.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TemporaryAccommodationBedSearchResult as BedSearchResult } from '../../server/@types/shared'
import paths from '../../server/paths/temporary-accommodation/manage'
import Component from './component'
import { formatNotes } from '../../server/utils/viewUtils'

export default class BedspaceSearchResult extends Component {
constructor(private readonly result: BedSearchResult) {
@@ -36,6 +37,22 @@ export default class BedspaceSearchResult extends Component {
cy.get('ul[data-cy-bedspace-key-characteristics] > li').should('contain', characteristic.name)
})

cy.get('div[data-cy-premises-notes]').within(() => {
const expectedNotesHTML = formatNotes(this.result.premises.notes)
.replace(/<br \/>/g, '<br>')
.replace(/<p>/g, '')
.replace(/<\/p>/g, '')

cy.get('h3').contains('Property notes')

cy.get('p').then(element => {
const renderedHTML = element.html()
expect(renderedHTML).to.eq(expectedNotesHTML)
})

// invoke('html').contains(notes)
})

this.result.overlaps.forEach((overlap, i) => {
cy.get('ul[data-cy-overlaps] > li')
.eq(i)
2 changes: 1 addition & 1 deletion cypress_shared/pages/page.ts
Original file line number Diff line number Diff line change
@@ -319,7 +319,7 @@ export default abstract class Page extends Component {

shouldShowCheckYourAnswersTitle(taskName: string, taskTitle: string) {
cy.get(`[data-cy-check-your-answers-section="${taskName}"]`).within(() => {
cy.get('.box-title').should('contain', taskTitle)
cy.get('h3').should('contain', taskTitle)
})
}

3 changes: 1 addition & 2 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: '3.1'
services:

redis:
image: 'bitnami/redis:7.0.11'
image: 'bitnami/redis:7.4.1'
networks:
- hmpps_int
environment:
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: '3.1'
services:

redis:
image: 'bitnami/redis:7.0.11'
image: 'bitnami/redis:7.4.1'
networks:
- hmpps
environment:
2 changes: 1 addition & 1 deletion e2e/tests/stepDefinitions/manage/departure.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ Given('I mark the booking as departed', () => {

const departure = departureFactory.build({
dateTime: DateFormats.dateObjToIsoDate(
fakerGB.date.future({ years: 1, refDate: DateFormats.isoToDateObj(this.booking.arrivalDate) }),
faker.date.future({ years: 1, refDate: DateFormats.isoToDateObj(this.booking.arrivalDate) }),
),
})
const newDeparture = newDepartureFactory.build({
6 changes: 4 additions & 2 deletions integration_tests/mockApis/report.ts
Original file line number Diff line number Diff line change
@@ -58,9 +58,11 @@ export default {
response: {
status: 200,
headers: {
'Content-Type': 'text/plain',
'Content-Type': 'application/octet-stream',
'Transfer-Encoding': 'chunked',
},
body: args.data,
// Simulate streaming by providing the data in chunks
body: `0\r\n\r\n${args.data}\r\n0\r\n\r\n`, // This simulates chunked transfer encoding
},
}),
verifyReportForRegion: async (args: {
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ context('Bedspace Search', () => {

expect(requestBody.startDate).equal(searchParameters.startDate)
expect(requestBody.durationDays).equal(searchParameters.durationDays)
expect(requestBody.probationDeliveryUnit).equal(searchParameters.probationDeliveryUnit)
expect(requestBody.probationDeliveryUnits).to.include.members(searchParameters.probationDeliveryUnits)
expect(requestBody.attributes).to.have.members(searchParameters.attributes)
})

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'path'
import { Cas3ReportType } from '@approved-premises/api'
import Page from '../../../../cypress_shared/pages/page'
import DashboardPage from '../../../../cypress_shared/pages/temporary-accommodation/dashboardPage'
import ReportIndexPage from '../../../../cypress_shared/pages/temporary-accommodation/manage/reportIndex'
@@ -32,39 +31,6 @@ context('Report', () => {
Page.verifyOnPage(ReportIndexPage)
})

it('does not download a file when the API returns an error', () => {
// Given I am signed in
cy.signIn()

// When I visit the report page
cy.task('stubReportReferenceData')
const page = ReportIndexPage.visit()

// And I fill out the form
const type: Cas3ReportType = 'booking'
cy.then(function _() {
const probationRegion = this.actingUserProbationRegion
const startDate = '12/01/2024'
const endDate = '12/03/2024'

page.completeForm(startDate, endDate)

cy.task('stubReportError', {
data: 'some-data',
probationRegionId: probationRegion.id,
startDate: DateFormats.datepickerInputToIsoString(startDate),
endDate: DateFormats.datepickerInputToIsoString(endDate),
type,
})
})

page.expectDownload()
page.clickDownload(type)

// Then I should see an error message
cy.get('h1').contains('Internal Server Error')
})

it("allows me to download a booking report for the acting user's region", () => {
// Given I am signed in
cy.signIn()
Loading