diff --git a/app/containers/Applications/ApplyButtonContainer.tsx b/app/containers/Applications/ApplyButtonContainer.tsx index bf1c0e53fd..46c9924c4b 100644 --- a/app/containers/Applications/ApplyButtonContainer.tsx +++ b/app/containers/Applications/ApplyButtonContainer.tsx @@ -53,7 +53,7 @@ export const ApplyButton: React.FunctionComponent = ({ ]); if (!canOpenApplication) { - return null; + return
; } if (!applicationId) { diff --git a/app/tests/unit/containers/Applications/ApplyButtonContainer.test.tsx b/app/tests/unit/containers/Applications/ApplyButtonContainer.test.tsx index c0becef9ea..ec46be4c46 100644 --- a/app/tests/unit/containers/Applications/ApplyButtonContainer.test.tsx +++ b/app/tests/unit/containers/Applications/ApplyButtonContainer.test.tsx @@ -63,7 +63,7 @@ describe('The apply button', () => { ); }); - it('should not render anything if no applicationByApplicationId exists and the application window is closed', () => { + it('should render an empty div if no applicationByApplicationId exists and the application window is closed', () => { const r = shallow( { /> ); - expect(r).toEqual({}); + expect(r.at(0).type()).toBe('div'); + expect(r.at(0).children().length).toBe(0); }); - it('should not render anything if no applicationByApplicationId exists and query.openedReportingYear.reportingYear !== reportingYear', () => { + it('should render an empty div if no applicationByApplicationId exists and query.openedReportingYear.reportingYear !== reportingYear', () => { const r = shallow( { expect(r.find('Button').text()).toBe('Resume CIIP application'); }); - it('should not render anything if an application revision exists with draft status, its versionNumber is 1, and the application window is closed', () => { + it('should render an empty div if an application revision exists with draft status, its versionNumber is 1, and the application window is closed', () => { const r = shallow( { /> ); - expect(r).toEqual({}); + expect(r.at(0).type()).toBe('div'); + expect(r.at(0).children().length).toBe(0); }); - it('should not render anything if an application revision exists with draft status, its versionNumber is > 1, and the application window is closed', () => { + it('should render a resume button if an application revision exists with draft status, its versionNumber is > 1, and the application window is closed', () => { const r = shallow( { reportingYear={2018} /> ); - - expect(r).toEqual({}); + expect(r.exists('Button')).toBe(true); + expect(r.find('Button').text()).toBe('Resume CIIP application'); }); it('should render a View Application button if an application revision exists with submitted status', () => {