import React from 'react'; import { shallow, mount } from 'enzyme'; import Block from '@Components/Block'; import { StoryAnchorItem, AnchorTitle, AnchorLink } from '.'; import 'jest-styled-components'; describe('StoryAnchorLinks component', () => { test('renders', () => { const wrapper = shallow( ); expect(wrapper).toMatchSnapshot(); }); test('it applies default styles', () => { const wrapper = mount( ); expect(wrapper).toHaveStyleRule('display', 'grid'); }); test('the first title is equal to `Hello`', () => { const wrapper = mount( ); const StoryTitle = wrapper.find(AnchorTitle).first(); expect(StoryTitle.text()).toEqual('Hello'); }); test('the first anchor is equal to `Beautiful cycling stocking fillers`', () => { const wrapper = mount( ); const StoryAnchor = wrapper.find(AnchorLink).first(); expect(StoryAnchor.text()).toEqual('Beautiful cycling stocking fillers'); }); test('renders with no subhead', () => { const wrapper = shallow( ); expect(wrapper).toMatchSnapshot(); }); });