diff --git a/packages/sitecore-jss-nextjs/src/components/Link.test.tsx b/packages/sitecore-jss-nextjs/src/components/Link.test.tsx index c741feb38b..774143e43b 100644 --- a/packages/sitecore-jss-nextjs/src/components/Link.test.tsx +++ b/packages/sitecore-jss-nextjs/src/components/Link.test.tsx @@ -351,14 +351,35 @@ describe('', () => { it('should render nothing with missing field', () => { const field = (null as unknown) as LinkField; - const rendered = mount().children(); - expect(rendered).to.have.length(0); + const rendered = mount(); + expect(rendered.html()).to.equal(null); }); it('should render nothing with missing field', () => { const field = {}; - const rendered = mount().children(); - expect(rendered).to.have.length(0); + const rendered = mount(); + expect(rendered.html()).to.equal(null); + }); + + it('should render nothing when field is present and href is not present', () => { + const field = { + value: { + text: 'ipsum', + }, + }; + const rendered = mount(); + expect(rendered.html()).to.equal(''); + }); + + it('should render when field is present and href is present', () => { + const field = { + value: { + text: 'ipsum', + href: '/lorem', + }, + }; + const rendered = mount(); + expect(rendered.html()).to.equal('ipsum'); }); describe('editMode metadata', () => {