diff --git a/app/controllers/licences.controller.js b/app/controllers/licences.controller.js index f84bda4e47..3391c9889c 100644 --- a/app/controllers/licences.controller.js +++ b/app/controllers/licences.controller.js @@ -5,65 +5,21 @@ * @module LicencesController */ -async function noReturnsRequired (request, h) { - const { id } = request.params - - return h.view('return-requirements/no-returns-required.njk', { - activeNavBar: 'search', - licenceId: id - }) -} - -async function selectReturnStartDate (request, h) { - const { id } = request.params - - return h.view('return-requirements/select-return-start-date.njk', { - activeNavBar: 'search', - licenceId: id - }) -} - -async function requirementsApproved (request, h) { - const { id } = request.params +const SessionModel = require('../models/session.model.js') - return h.view('return-requirements/requirements-approved.njk', { - activeNavBar: 'search', - licenceId: id - }) -} - -async function noReturnsCheckYourAnswers (request, h) { - const { id } = request.params - - return h.view('return-requirements/no-return-check-your-answers.njk', { - activeNavBar: 'search', - licenceId: id - }) -} - -async function returnsCheckYourAnswers (request, h) { +async function noReturnsRequired (request, h) { const { id } = request.params - return h.view('return-requirements/returns-check-your-answers.njk', { - activeNavBar: 'search', - licenceId: id - }) -} - -async function addANote (request, h) { - const { id } = request.params + const data = { licenceId: id } + const session = await SessionModel.query() + .insert({ + data + }) + .returning('*') - return h.view('return-requirements/add-a-note.njk', { - activeNavBar: 'search', - licenceId: id - }) + return h.redirect(`/system/return-requirements/${session.id}/select-return-start-date`) } module.exports = { - addANote, - noReturnsCheckYourAnswers, - noReturnsRequired, - requirementsApproved, - returnsCheckYourAnswers, - selectReturnStartDate + noReturnsRequired } diff --git a/app/controllers/return-requirements.controller.js b/app/controllers/return-requirements.controller.js new file mode 100644 index 0000000000..6e6228133b --- /dev/null +++ b/app/controllers/return-requirements.controller.js @@ -0,0 +1,164 @@ +'use strict' + +/** + * Controller for /return-requirement endpoints + * @module ReturnRequirementsController + */ + +const SessionModel = require('../models/session.model.js') + +async function selectReturnStartDate (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/select-return-start-date.njk', { + activeNavBar: 'search', + ...session + }) +} + +async function saveReturnStartDate (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.redirect(`/system/return-requirements/${session.id}/reason`) +} + +async function reasonNewRequirements (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/reason.njk', { + activeNavBar: 'search', + ...session + }) +} + +async function saveReasonNewRequirements (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.redirect(`/system/return-requirements/${session.id}/returns-how-do-you-want`) +} + +async function returnsHowDoYouWant (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/returns-how-do-you-want.njk', { + activeNavBar: 'search', + ...session + }) +} + +async function saveReturnsHowDoYouWant (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.redirect(`/system/return-requirements/${session.id}/returns-check-your-answers`) +} + +async function returnsCheckYourAnswers (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/returns-check-your-answers.njk', { + activeNavBar: 'search', + ...session + }) +} + +async function saveReturnsCheckYourAnswers (request, h) { + return h.redirect('/system/return-requirements/requirements-approved') +} + +async function requirementsApproved (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/requirements-approved.njk', { + activeNavBar: 'search', + ...session + }) +} + +async function noReturnsRequired (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/no-returns-required.njk', { + activeNavBar: 'search', + ...session + }) +} + +async function saveNoReturnsRequired (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.redirect(`/system/return-requirements/${session.id}/no-returns-check-your-answers`) +} + +async function noReturnsCheckYourAnswers (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/no-return-check-your-answers.njk', { + activeNavBar: 'search', + ...session + }) +} + +async function saveNoReturnsCheckYourAnswers (request, h) { + return h.redirect('/system/return-requirements/requirements-approved') +} + +async function addANote (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/add-a-note.njk', { + activeNavBar: 'search', + ...session + }) +} + +async function saveNote (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + const { id } = session + + return h.redirect(`/system/return-requirements/${id}/returns-check-your-answers`) +} + +module.exports = { + addANote, + noReturnsCheckYourAnswers, + noReturnsRequired, + reasonNewRequirements, + requirementsApproved, + returnsCheckYourAnswers, + returnsHowDoYouWant, + saveNoReturnsCheckYourAnswers, + saveNoReturnsRequired, + saveNote, + saveReasonNewRequirements, + saveReturnsCheckYourAnswers, + saveReturnsHowDoYouWant, + saveReturnStartDate, + selectReturnStartDate +} diff --git a/app/plugins/router.plugin.js b/app/plugins/router.plugin.js index 24577d70b9..d218cf1e6e 100644 --- a/app/plugins/router.plugin.js +++ b/app/plugins/router.plugin.js @@ -22,6 +22,7 @@ const FilterRoutesService = require('../services/plugins/filter-routes.service.j const HealthRoutes = require('../routes/health.routes.js') const JobRoutes = require('../routes/jobs.routes.js') const LicenceRoutes = require('../routes/licence.routes.js') +const ReturnRequirementRoutes = require('../routes/return-requirement.routes.js') const RootRoutes = require('../routes/root.routes.js') const AirbrakeConfig = require('../../config/airbrake.config.js') @@ -36,6 +37,7 @@ const routes = [ ...BillingAccountRoutes, ...LicenceRoutes, ...JobRoutes, + ...ReturnRequirementRoutes, ...CheckRoutes, ...DataRoutes ] diff --git a/app/routes/licence.routes.js b/app/routes/licence.routes.js index 0e722f76ad..dc2dd3c6c1 100644 --- a/app/routes/licence.routes.js +++ b/app/routes/licence.routes.js @@ -15,66 +15,6 @@ const routes = [ }, description: 'Review two-part tariff match and allocation results' } - }, { - method: 'GET', - path: '/licences/{id}/select-return-start-date', - handler: LicencesController.selectReturnStartDate, - options: { - auth: { - access: { - scope: ['billing'] - } - }, - description: 'Select the start date of the return' - } - }, { - method: 'GET', - path: '/licences/{id}/no-return-check-your-answers', - handler: LicencesController.noReturnsCheckYourAnswers, - options: { - auth: { - access: { - scope: ['billing'] - } - }, - description: 'No return check your answers page' - } - }, { - method: 'GET', - path: '/licences/{id}/requirements-approved', - handler: LicencesController.requirementsApproved, - options: { - auth: { - access: { - scope: ['billing'] - } - }, - description: 'Returns requirements approved' - } - }, { - method: 'GET', - path: '/licences/{id}/returns-check-your-answers', - handler: LicencesController.returnsCheckYourAnswers, - options: { - auth: { - access: { - scope: ['billing'] - } - }, - description: 'Returns check your answers page' - } - }, { - method: 'GET', - path: '/licences/{id}/add-a-note', - handler: LicencesController.addANote, - options: { - auth: { - access: { - scope: ['billing'] - } - }, - description: 'Returns add a note page' - } } ] diff --git a/app/routes/return-requirement.routes.js b/app/routes/return-requirement.routes.js new file mode 100644 index 0000000000..2339d56b83 --- /dev/null +++ b/app/routes/return-requirement.routes.js @@ -0,0 +1,189 @@ +'use strict' + +const ReturnRequirementsController = require('../controllers/return-requirements.controller.js') + +const routes = [ + { + method: 'GET', + path: '/return-requirements/{sessionId}/select-return-start-date', + handler: ReturnRequirementsController.selectReturnStartDate, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Select the start date of the return' + } + }, { + method: 'POST', + path: '/return-requirements/{sessionId}/select-return-start-date', + handler: ReturnRequirementsController.saveReturnStartDate, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Select the start date of the return' + } + }, { + method: 'GET', + path: '/return-requirements/{sessionId}/reason', + handler: ReturnRequirementsController.reasonNewRequirements, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Reason page' + } + }, { + method: 'POST', + path: '/return-requirements/{sessionId}/reason', + handler: ReturnRequirementsController.saveReasonNewRequirements, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Reason page' + } + }, { + method: 'GET', + path: '/return-requirements/{sessionId}/returns-how-do-you-want', + handler: ReturnRequirementsController.returnsHowDoYouWant, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Returns required - create How do you want to set up the requirements' + } + }, { + method: 'POST', + path: '/return-requirements/{sessionId}/returns-how-do-you-want', + handler: ReturnRequirementsController.saveReturnsHowDoYouWant, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Returns required - create How do you want to set up the requirements' + } + }, { + method: 'GET', + path: '/return-requirements/{sessionId}/returns-check-your-answers', + handler: ReturnRequirementsController.returnsCheckYourAnswers, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Returns check your answers page' + } + }, { + method: 'POST', + path: '/return-requirements/{sessionId}/returns-check-your-answers', + handler: ReturnRequirementsController.saveReturnsCheckYourAnswers, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Returns check your answers page' + } + }, { + method: 'GET', + path: '/return-requirements/{sessionId}/requirements-approved', + handler: ReturnRequirementsController.requirementsApproved, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Returns requirements approved' + } + }, { + method: 'GET', + path: '/return-requirements/{sessionId}/no-returns-required', + handler: ReturnRequirementsController.noReturnsRequired, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Show no returns required page' + } + }, { + method: 'POST', + path: '/return-requirements/{sessionId}/no-returns-required', + handler: ReturnRequirementsController.saveNoReturnsRequired, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Save no returns required option' + } + }, { + method: 'GET', + path: '/return-requirements/{sessionId}/no-return-check-your-answers', + handler: ReturnRequirementsController.noReturnsCheckYourAnswers, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'No return check your answers page' + } + }, { + method: 'POST', + path: '/return-requirements/{sessionId}/no-return-check-your-answers', + handler: ReturnRequirementsController.saveNoReturnsCheckYourAnswers, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'No return check your answers page' + } + }, { + method: 'GET', + path: '/return-requirements/{sessionId}/add-a-note', + handler: ReturnRequirementsController.addANote, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Returns add a note page' + } + }, { + method: 'POST', + path: '/return-requirements/{sessionId}/add-a-note', + handler: ReturnRequirementsController.saveNote, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Save note' + } + } +] + +module.exports = routes diff --git a/app/views/return-requirements/add-a-note.njk b/app/views/return-requirements/add-a-note.njk index 7d7958a95e..3e2dea4d75 100644 --- a/app/views/return-requirements/add-a-note.njk +++ b/app/views/return-requirements/add-a-note.njk @@ -19,7 +19,9 @@

Add a note

-
- {{ govukButton({ text: "Confirm" }) }} -
+
+
+ {{ govukButton({ text: "Confirm" }) }} +
+
{% endblock %} diff --git a/app/views/return-requirements/no-return-check-your-answers.njk b/app/views/return-requirements/no-return-check-your-answers.njk index e0df257e08..e1db24282a 100644 --- a/app/views/return-requirements/no-return-check-your-answers.njk +++ b/app/views/return-requirements/no-return-check-your-answers.njk @@ -19,7 +19,10 @@

Check your answers

-
- {{ govukButton({ text: "Approve returns requirements" }) }} -
+
+
+ {{ govukButton({ text: "Approve returns requirements" }) }} +
+
+ {% endblock %} diff --git a/app/views/return-requirements/no-returns-required.njk b/app/views/return-requirements/no-returns-required.njk index 8522b016e5..d2073ee98b 100644 --- a/app/views/return-requirements/no-returns-required.njk +++ b/app/views/return-requirements/no-returns-required.njk @@ -19,7 +19,10 @@

Why are no returns required?

-
- {{ govukButton({ text: "Continue" }) }} -
+
+
+ {{ govukButton({ text: "Continue" }) }} +
+
+ {% endblock %} diff --git a/app/views/return-requirements/reason.njk b/app/views/return-requirements/reason.njk new file mode 100644 index 0000000000..37bdca354c --- /dev/null +++ b/app/views/return-requirements/reason.njk @@ -0,0 +1,29 @@ +{% extends 'layout.njk' %} +{% from "govuk/components/back-link/macro.njk" import govukBackLink %} +{% from "govuk/components/button/macro.njk" import govukButton %} + +{% set title = "Select the reason for the return requirement" %} +{% set rootLink = "/system/licences/" + licenceId %} + +{% block breadcrumbs %} + {# Back link #} + {{ + govukBackLink({ + text: 'back', + href: rootLink + "/" + }) + }} +{% endblock %} + +{% block content %} + {# Main heading #} +
+

{{ title }}

+
+ +
+
+ {{ govukButton({ text: "Continue" }) }} +
+
+{% endblock %} diff --git a/app/views/return-requirements/returns-check-your-answers.njk b/app/views/return-requirements/returns-check-your-answers.njk index a2bd5d0eb8..8f28758beb 100644 --- a/app/views/return-requirements/returns-check-your-answers.njk +++ b/app/views/return-requirements/returns-check-your-answers.njk @@ -19,7 +19,9 @@

Check your answers

-
- {{ govukButton({ text: "Approve returns requirements" }) }} -
+
+
+ {{ govukButton({ text: "Approve returns requirements" }) }} +
+
{% endblock %} diff --git a/app/views/return-requirements/returns-how-do-you-want.njk b/app/views/return-requirements/returns-how-do-you-want.njk new file mode 100644 index 0000000000..d318c0355d --- /dev/null +++ b/app/views/return-requirements/returns-how-do-you-want.njk @@ -0,0 +1,28 @@ +{% extends 'layout.njk' %} +{# {% from "govuk/components/back-link/macro.njk" import govukBackLink %} #} +{# {% from "govuk/components/button/macro.njk" import govukButton %} #} + +{# {% set rootLink = "/system/licences/" + licenceId %} #} + +{% block breadcrumbs %} + {# Back link #} + {# {{ + govukBackLink({ + text: 'back', + href: rootLink + "/reason" + }) + }} #} +{% endblock %} + +{% block content %} + {# Main heading #} +
+

How do you want to set up the return requirement?

+
+ + {#
+
+ {{ govukButton({ text: "Continue" }) }} +
+
#} +{% endblock %} diff --git a/app/views/return-requirements/select-return-start-date.njk b/app/views/return-requirements/select-return-start-date.njk index f119dc05f2..5a4e973ae8 100644 --- a/app/views/return-requirements/select-return-start-date.njk +++ b/app/views/return-requirements/select-return-start-date.njk @@ -19,7 +19,9 @@

Select the start date for the return requirement

-
- {{ govukButton({ text: "Continue" }) }} -
+
+
+ {{ govukButton({ text: "Continue" }) }} +
+
{% endblock %} diff --git a/test/controllers/licences.controller.test.js b/test/controllers/licences.controller.test.js index ad081b3e2e..53c85c808b 100644 --- a/test/controllers/licences.controller.test.js +++ b/test/controllers/licences.controller.test.js @@ -32,26 +32,6 @@ describe('Licences controller', () => { Sinon.restore() }) - describe('GET /licences/{id}/select-return-start-date', () => { - const options = { - method: 'GET', - url: '/licences/64924759-8142-4a08-9d1e-1e902cd9d316/select-return-start-date', - auth: { - strategy: 'session', - credentials: { scope: ['billing'] } - } - } - - describe('when the request succeeds', () => { - it('returns the page successfully', async () => { - const response = await server.inject(options) - - expect(response.statusCode).to.equal(200) - expect(response.payload).to.contain('Select the start date for the return requirement') - }) - }) - }) - describe('GET /licences/{id}/no-returns-required', () => { const options = { method: 'GET', @@ -63,91 +43,10 @@ describe('Licences controller', () => { } describe('when the request succeeds', () => { - it('returns the page successfully', async () => { - const response = await server.inject(options) - - expect(response.statusCode).to.equal(200) - expect(response.payload).to.contain('Why are no returns required?') - }) - }) - }) - - describe('GET /licences/{id}/requirements-approved', () => { - const options = { - method: 'GET', - url: '/licences/64924759-8142-4a08-9d1e-1e902cd9d316/requirements-approved', - auth: { - strategy: 'session', - credentials: { scope: ['billing'] } - } - } - - describe('when the request succeeds', () => { - it('returns the page successfully', async () => { - const response = await server.inject(options) - - expect(response.statusCode).to.equal(200) - expect(response.payload).to.contain('Returns requirements approved') - }) - }) - }) - - describe('GET /licences/{id}/no-return-check-your-answers', () => { - const options = { - method: 'GET', - url: '/licences/64924759-8142-4a08-9d1e-1e902cd9d316/no-return-check-your-answers', - auth: { - strategy: 'session', - credentials: { scope: ['billing'] } - } - } - - describe('when the request succeeds', () => { - it('returns the page successfully', async () => { - const response = await server.inject(options) - - expect(response.statusCode).to.equal(200) - expect(response.payload).to.contain('Check your answers') - }) - }) - }) - - describe('GET /licences/{id}/returns-check-your-answers', () => { - const options = { - method: 'GET', - url: '/licences/64924759-8142-4a08-9d1e-1e902cd9d316/returns-check-your-answers', - auth: { - strategy: 'session', - credentials: { scope: ['billing'] } - } - } - - describe('when the request succeeds', () => { - it('returns the page successfully', async () => { - const response = await server.inject(options) - - expect(response.statusCode).to.equal(200) - expect(response.payload).to.contain('Check your answers') - }) - }) - }) - - describe('GET /licences/{id}/add-a-note', () => { - const options = { - method: 'GET', - url: '/licences/64924759-8142-4a08-9d1e-1e902cd9d316/add-a-note', - auth: { - strategy: 'session', - credentials: { scope: ['billing'] } - } - } - - describe('when the request succeeds', () => { - it('returns the page successfully', async () => { + it('creates a record in the sessions table and redirects to no retuns required reason page', async () => { const response = await server.inject(options) - expect(response.statusCode).to.equal(200) - expect(response.payload).to.contain('Add a note') + expect(response.statusCode).to.equal(302) }) }) }) diff --git a/test/controllers/return-requirements.controller.test.js b/test/controllers/return-requirements.controller.test.js new file mode 100644 index 0000000000..6f78cb0eed --- /dev/null +++ b/test/controllers/return-requirements.controller.test.js @@ -0,0 +1,194 @@ +'use strict' + +// Test framework dependencies +const Lab = require('@hapi/lab') +const Code = require('@hapi/code') +const Sinon = require('sinon') + +const { describe, it, beforeEach, afterEach } = exports.lab = Lab.script() +const { expect } = Code + +// Things we need to stub + +// For running our service +const { init } = require('../../app/server.js') + +describe('Return requirements controller', () => { + let server + + beforeEach(async () => { + // Create server before each test + server = await init() + + // We silence any calls to server.logger.error made in the plugin to try and keep the test output as clean as + // possible + Sinon.stub(server.logger, 'error') + + // We silence sending a notification to our Errbit instance using Airbrake + Sinon.stub(server.app.airbrake, 'notify').resolvesThis() + }) + + afterEach(() => { + Sinon.restore() + }) + + describe('GET /return-requirements/{sessionId}/select-return-start-date', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/select-return-start-date', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('Select the start date for the return requirement') + }) + }) + }) + + describe('GET /return-requirements/{sessionId}/reason', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/reason', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('Select the reason for the return requirement') + }) + }) + }) + + describe('GET /return-requirements/{sessionId}/returns-how-do-you-want', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/returns-how-do-you-want', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('How do you want to set up the return requirement?') + }) + }) + }) + + describe('GET /return-requirements/{sessionId}/no-returns-required', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/no-returns-required', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('Why are no returns required?') + }) + }) + }) + + describe('GET /return-requirements/{sessionId}/requirements-approved', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/requirements-approved', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('Returns requirements approved') + }) + }) + }) + + describe('GET /return-requirements/{sessionId}/no-return-check-your-answers', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/no-return-check-your-answers', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('Check your answers') + }) + }) + }) + + describe('GET /return-requirements/{sessionId}/returns-check-your-answers', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/returns-check-your-answers', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('Check your answers') + }) + }) + }) + + describe('GET /return-requirements/{sessionId}/add-a-note', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/add-a-note', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('Add a note') + }) + }) + }) +})