-
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 #4 from cabinetoffice/NTRNL-299-add-confirmation-page
Ntrnl 299 add confirmation page
- Loading branch information
Showing
12 changed files
with
113 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Request, Response } from 'express'; | ||
import * as config from '../config'; | ||
|
||
export const get = (_req: Request, res: Response) => { | ||
return res.render(config.CONFIRMATION); | ||
}; |
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,10 @@ | ||
import { Router } from 'express'; | ||
|
||
import { get } from '../controller/confirmation.controller'; | ||
import * as config from '../config'; | ||
|
||
const confirmationRouter = Router(); | ||
|
||
confirmationRouter.get(config.CONFIRMATION_URL, get); | ||
|
||
export default confirmationRouter; |
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,29 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% set mainClasses = "govuk-main-wrapper--l" %} | ||
|
||
{% block content %} | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
{{ govukPanel({ | ||
titleText: "GitHub request complete", | ||
html: "Your reference number<br><strong>987654321</strong>" | ||
}) }} | ||
|
||
<p class="govuk-body">We have sent you a confirmation email.</p> | ||
|
||
<h2 class="govuk-heading-m">What happens next</h2> | ||
|
||
<p class="govuk-body"> | ||
We’ve sent your request to cabinetoffice internal developer platform. | ||
</p> | ||
<p class="govuk-body"> | ||
They will contact you either to confirm your request, or to ask for more information. | ||
</p> | ||
|
||
<p class="govuk-body"> | ||
<a href="#" class="govuk-link">What did you think of this service?</a> (takes 30 seconds) | ||
</p> | ||
</div> | ||
</div> | ||
{% endblock %} |
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,31 @@ | ||
jest.mock('../../../src/middleware/logger.middleware'); | ||
jest.mock('../../../src/utils/logger'); | ||
|
||
import { jest, beforeEach, describe, expect, test } from '@jest/globals'; | ||
import { Request, Response, NextFunction } from 'express'; | ||
import request from 'supertest'; | ||
|
||
import app from '../../../src/app'; | ||
import * as config from '../../../src/config'; | ||
import { logger } from '../../../src/middleware/logger.middleware'; | ||
|
||
import { MOCK_GET_CONFIRMATION_RESPONSE } from '../../mock/text.mock'; | ||
|
||
const mockedLogger = logger as jest.Mock<typeof logger>; | ||
mockedLogger.mockImplementation((req: Request, res: Response, next: NextFunction) => next()); | ||
|
||
describe('Confirmation endpoint integration tests', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
describe('GET tests', () => { | ||
test('should render confirmation template', async () => { | ||
const res = await request(app).get(config.CONFIRMATION_URL); | ||
|
||
expect(res.status).toEqual(200); | ||
expect(res.text).toContain(MOCK_GET_CONFIRMATION_RESPONSE); | ||
expect(mockedLogger).toHaveBeenCalledTimes(1); | ||
}); | ||
}); | ||
}); |
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,27 @@ | ||
import { describe, expect, afterEach, test, jest } from '@jest/globals'; | ||
import { Request, Response } from 'express'; | ||
|
||
import { get } from '../../../src/controller/confirmation.controller'; | ||
import * as config from '../../../src/config'; | ||
|
||
const req = {} as Request; | ||
|
||
const mockResponse = () => { | ||
const res = {} as Response; | ||
res.render = jest.fn().mockReturnValue(res) as any; | ||
return res; | ||
}; | ||
|
||
describe('Confirmation controller test suites', () => { | ||
afterEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
test('should render confirmation template', () => { | ||
const res = mockResponse(); | ||
|
||
get(req, res); | ||
|
||
expect(res.render).toHaveBeenCalledWith(config.CONFIRMATION); | ||
}); | ||
}); |