From d3ad5e700402dd1b09c3f682c7071afd4deb264d Mon Sep 17 00:00:00 2001 From: Chris Sherlock <99017916+cshnimble@users.noreply.github.com> Date: Mon, 22 Jan 2024 15:05:03 +0000 Subject: [PATCH] Update v4 cypress test to check for values regardless of order (#450) --- CypressTests/cypress/e2e/v4/trusts.cy.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CypressTests/cypress/e2e/v4/trusts.cy.js b/CypressTests/cypress/e2e/v4/trusts.cy.js index e84e9f6b9..cd95c5e46 100644 --- a/CypressTests/cypress/e2e/v4/trusts.cy.js +++ b/CypressTests/cypress/e2e/v4/trusts.cy.js @@ -154,11 +154,13 @@ describe('Trusts endpoints tests', () => { }) .then((response) => { expect(response.status).to.eq(200) - // Response isn't in UKPRN order - expect(response.body[1].name).to.eq(groupName) - expect(response.body[1].ukprn).to.eq(ukprns[0]) - expect(response.body[0].name).to.eq('THE BISHOP FRASER TRUST') - expect(response.body[0].ukprn).to.eq(ukprns[1]) + expect(response.body).to.have.lengthOf(2) + // Response isn't neccessarily in UKPRN order + const resBody = JSON.stringify(response.body) + expect(resBody).to.have.string(groupName) + expect(resBody).to.have.string(ukprns[0]) + expect(resBody).to.have.string('THE BISHOP FRASER TRUST') + expect(resBody).to.have.string(ukprns[1]) }) }) })