Skip to content

Commit

Permalink
Fixed broken component tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhudec authored and paulgain committed Aug 7, 2024
1 parent b97d314 commit 799fc23
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions test/component/cypress/specs/ExportWins/Review.cy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ const assertReviewForm = ({ agree }) => {
Experience: () => Promise.resolve(EXPERIENCE),
MarketingSource: () => Promise.resolve(MARKETING_SOURCE),
TASK_PATCH_EXPORT_WIN_REVIEW: () => Promise.resolve({}),
'load cookie preference': () => 'granted',
},
initialPath: '/exportwins/review/123',
initialPath: '/123',
})

assertHeader()
Expand Down Expand Up @@ -337,16 +338,17 @@ describe('ExportWins/Review', () => {
Experience: () => Promise.resolve(EXPERIENCE),
MarketingSource: () => Promise.resolve(MARKETING_SOURCE),
TASK_PATCH_EXPORT_WIN_REVIEW: () => Promise.resolve({}),
'load cookie preference': () => 'granted',
},
initialPath: '/exportwins/review/123',
initialPath: '/123',
})

cy.get('footer').within(() => {
// There should be 3 links including the Crown copyright
cy.get('a').should('have.length', 3)
cy.get('a').should('have.length', 4)

// Links should be in a particular order
cy.contains('Privacy Policy' + 'Accessibility Statement')
cy.contains('Privacy Policy' + 'Accessibility Statement' + 'Cookies')

cy.contains('a', 'Privacy Policy').should(
'have.attr',
Expand All @@ -358,6 +360,11 @@ describe('ExportWins/Review', () => {
'href',
'/exportwins/review/accesibility-statement'
)
cy.contains('a', 'Cookies').should(
'have.attr',
'href',
'/exportwins/review/cookies'
)
})
})

Expand All @@ -369,8 +376,9 @@ describe('ExportWins/Review', () => {
Promise.reject({
httpStatusCode: 404,
}),
initialPath: '/exportwins/review/123',
'load cookie preference': () => 'granted',
},
initialPath: '/123',
})

assertHeader()
Expand All @@ -388,8 +396,9 @@ describe('ExportWins/Review', () => {
cy.mountWithProvider(<Review />, {
tasks: {
'Export Win Review': () => Promise.reject({}),
'load cookie preference': () => 'granted',
},
initialPath: '/exportwins/review/123',
initialPath: '/123',
})

assertHeader()
Expand Down

0 comments on commit 799fc23

Please sign in to comment.