-
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.
Merge pull request #81 from DEFRA/DSFAAP-612_Privacy-policy-page
DSFAAP-612: Privacy policy page
- Loading branch information
Showing
9 changed files
with
629 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @satisfies {Partial<ServerRoute>} | ||
*/ | ||
export const privacyPolicyController = { | ||
handler(_request, h) { | ||
return h.view('privacy-policy/index', { | ||
pageTitle: 'Privacy Policy', | ||
heading: 'Privacy Policy' | ||
}) | ||
} | ||
} | ||
|
||
/** | ||
* @import { ServerRoute } from '@hapi/hapi' | ||
*/ |
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,32 @@ | ||
import { createServer } from '~/src/server/index.js' | ||
import { statusCodes } from '~/src/server/common/constants/status-codes.js' | ||
import { parseDocument } from '~/src/server/common/test-helpers/dom.js' | ||
|
||
describe('#privacyPolicyController', () => { | ||
/** @type {Server} */ | ||
let server | ||
|
||
beforeAll(async () => { | ||
server = await createServer() | ||
await server.initialize() | ||
}) | ||
|
||
afterAll(async () => { | ||
await server.stop({ timeout: 0 }) | ||
}) | ||
|
||
it('Should provide expected response', async () => { | ||
const { payload, statusCode } = await server.inject({ | ||
method: 'GET', | ||
url: '/privacy-policy' | ||
}) | ||
|
||
expect(parseDocument(payload).title).toBe('Privacy Policy') | ||
|
||
expect(statusCode).toBe(statusCodes.ok) | ||
}) | ||
}) | ||
|
||
/** | ||
* @import { Server } from '@hapi/hapi' | ||
*/ |
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 @@ | ||
import { privacyPolicyController } from './controller.js' | ||
|
||
/** | ||
* Sets up the routes used in the privacy policy page. | ||
* These routes are registered in src/server/router.js. | ||
*/ | ||
|
||
/** | ||
* @satisfies {ServerRegisterPluginObject<void>} | ||
*/ | ||
export const privacyPolicy = { | ||
plugin: { | ||
name: 'privacy-policy', | ||
register(server) { | ||
server.route([ | ||
{ | ||
method: 'GET', | ||
path: '/privacy-policy', | ||
...privacyPolicyController | ||
} | ||
]) | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @import { ServerRegisterPluginObject } from '@hapi/hapi' | ||
*/ |
Oops, something went wrong.