Skip to content

Commit 6bc2a53

Browse files
Added unit tests
1 parent f488bc2 commit 6bc2a53

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/sitecore-jss-nextjs/src/components/Link.test.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,28 @@ describe('<Link />', () => {
165165
expect(c.find(ReactLink).length).to.equal(0);
166166
});
167167

168+
it('should render with prefetch prop provided', () => {
169+
const field = {
170+
href: '/lorem',
171+
text: 'ipsum',
172+
};
173+
const c = mount(
174+
<Page>
175+
<Link field={field} prefetch={false} />
176+
</Page>
177+
);
178+
179+
const link = c.find('a');
180+
181+
expect(link.html()).to.contain(field.href);
182+
expect(link.html()).to.contain(field.text);
183+
184+
expect(c.find(NextLink).length).to.equal(1);
185+
expect(c.find(ReactLink).length).to.equal(0);
186+
187+
expect(c.find(NextLink).props().prefetch).to.equal(false);
188+
});
189+
168190
it('should render other attributes with other props provided', () => {
169191
const field = {
170192
value: {

0 commit comments

Comments
 (0)