From 0e0f6bd2c79f3506c838f54f49be9bfb7ff5b18c Mon Sep 17 00:00:00 2001 From: Hanna Laakso Date: Thu, 21 Feb 2019 11:54:56 +0000 Subject: [PATCH] Add tests for news and communications page --- app/full-page-examples.test.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/full-page-examples.test.js b/app/full-page-examples.test.js index 37ac81dfbc..b8de1927a7 100644 --- a/app/full-page-examples.test.js +++ b/app/full-page-examples.test.js @@ -362,6 +362,33 @@ describe(`http://localhost:${PORT}/full-page-examples/`, () => { }) }) + describe('news-and-communications', () => { + it('should show most wanted results by default', (done) => { + requestPath.get('news-and-communications', (err, res) => { + let $ = cheerio.load(res.body) + // Check the results are correct + expect($.html()).toContain('822,411 results') + done(err) + }) + }) + it('should show sorted results when selected', (done) => { + requestPath.get('news-and-communications?order=updated-newest', (err, res) => { + let $ = cheerio.load(res.body) + // Check the results are correct + expect($.html()).toContain('142,218 results') + done(err) + }) + }) + it('should show organisation results when selected', (done) => { + requestPath.get('news-and-communications?order=updated-newest&organisation=hmrc', (err, res) => { + let $ = cheerio.load(res.body) + // Check the results are correct + expect($.html()).toContain('421,182 results') + done(err) + }) + }) + }) + describe('what-was-the-last-country-you-visited', () => { it('should not show errors if submit with no input', (done) => { requestPath.get('what-was-the-last-country-you-visited', (err, res) => {