Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VB-3725 Select visitors page: add prison-specific visitor config #52

Merged
merged 10 commits into from
May 14, 2024

Conversation

tpmcgowan
Copy link
Contributor

@tpmcgowan tpmcgowan commented May 14, 2024

  • Look up prison config to show allowed visitor numbers/ages
  • Add GOVUK Error summary component and associated Nunjucks filters for validation errors (copied from Admin UI)
  • Update test utils to handle mocking session data and flash
  • Add tests for Select visitors page GET and POST route

// selected visitors for this visit
selectedVisitors?: VisitorInfoDto[]
}

export type FlashData = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For typing what we do with req.flash()

const app = express()

app.set('view engine', 'njk')

nunjucksSetup(app, testAppInfo)
app.use(cookieSession({ keys: [''] }))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing cookie-session as it was interfering with simply passing through an object to mock req.session - and it didn't appear to be doing anything useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the session stored if this is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically just a SessionData object (defaulting to { }) is now passed through so data can be seeded before requests and stuff can be 'saved' into it.

I guess without a 'proper' module like cookie-session we're not getting any of the things like session.destroy() - but nothing like that gets called. (Auth code does, but that's not included in this test app setup; it just assumes a logged in user.)

In Staff UI we removed this too. I think in the Admin UI its still there - but we don't use req.session so doesn't matter.

@@ -26,7 +26,7 @@
<link href="/assets/stylesheets/application.css?{{ version }}" rel="stylesheet"/>
{% endblock %}

{% block pageTitle %}{{pageTitle | default(applicationName)}}{% endblock %}
{% block pageTitle %}{{ pageTitle + " - " if pageTitle }}{{ applicationName }} - GOV.UK{% endblock %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standardise page titles along GDS guidelines

Copy link
Contributor

@psoleckimoj psoleckimoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just the question re cookie-session

@tpmcgowan tpmcgowan merged commit 5ae37f5 into main May 14, 2024
7 of 8 checks passed
@tpmcgowan tpmcgowan deleted the vb-3725_get-prison-config branch May 14, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants