|
| 1 | +import { FACILITY_TYPE } from '@ukef/dtfs2-common'; |
| 2 | +import pageRenderer from '../../pageRenderer'; |
| 3 | +import { CheckYourAnswersViewModel } from '../../../server/types/view-models/amendments/check-your-answers-view-model'; |
| 4 | + |
| 5 | +const page = 'partials/amendments/check-your-answers.njk'; |
| 6 | +const render = pageRenderer(page); |
| 7 | + |
| 8 | +describe(page, () => { |
| 9 | + const previousPage = 'previousPage'; |
| 10 | + const cancelUrl = 'cancelUrl'; |
| 11 | + const exporterName = 'exporterName'; |
| 12 | + const facilityType = FACILITY_TYPE.CASH; |
| 13 | + |
| 14 | + const params: CheckYourAnswersViewModel = { |
| 15 | + previousPage, |
| 16 | + cancelUrl, |
| 17 | + exporterName, |
| 18 | + facilityType, |
| 19 | + amendmentSummaryListParams: { |
| 20 | + amendmentRows: [], |
| 21 | + eligibilityRows: [], |
| 22 | + effectiveDateRows: [], |
| 23 | + }, |
| 24 | + }; |
| 25 | + it('should render the page heading', () => { |
| 26 | + const wrapper = render(params); |
| 27 | + |
| 28 | + wrapper.expectText('[data-cy="page-heading"]').toContain('Check your answers before submitting the amendment request'); |
| 29 | + }); |
| 30 | + |
| 31 | + it(`should render the 'Back' link`, () => { |
| 32 | + const wrapper = render(params); |
| 33 | + |
| 34 | + wrapper.expectLink('[data-cy="back-link"]').toLinkTo(previousPage, 'Back'); |
| 35 | + }); |
| 36 | + |
| 37 | + it(`should render the submit button`, () => { |
| 38 | + const wrapper = render(params); |
| 39 | + |
| 40 | + wrapper.expectPrimaryButton('[data-cy="submit-button"]').toLinkTo(undefined, 'Submit to be checked at your bank'); |
| 41 | + }); |
| 42 | + |
| 43 | + it(`should render the cancel link`, () => { |
| 44 | + const wrapper = render(params); |
| 45 | + |
| 46 | + wrapper.expectLink('[data-cy="cancel-link"]').toLinkTo(cancelUrl, 'Cancel'); |
| 47 | + }); |
| 48 | + |
| 49 | + it('should render the exporter name and facility type in the heading caption', () => { |
| 50 | + const wrapper = render(params); |
| 51 | + |
| 52 | + wrapper.expectText('[data-cy="heading-caption"]').toRead(`${exporterName}, ${facilityType} facility`); |
| 53 | + }); |
| 54 | + |
| 55 | + it('should render amendment summary list', () => { |
| 56 | + const wrapper = render(params); |
| 57 | + |
| 58 | + wrapper.expectElement('[data-cy="amendments-summary-list"]').toExist(); |
| 59 | + }); |
| 60 | + |
| 61 | + it('should render eligibility summary list', () => { |
| 62 | + const wrapper = render(params); |
| 63 | + |
| 64 | + wrapper.expectElement('[data-cy="eligibility-summary-list"]').toExist(); |
| 65 | + }); |
| 66 | + |
| 67 | + it('should render effective date summary list', () => { |
| 68 | + const wrapper = render(params); |
| 69 | + |
| 70 | + wrapper.expectElement('[data-cy="effective-date-summary-list"]').toExist(); |
| 71 | + }); |
| 72 | +}); |
0 commit comments