Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Last active December 9, 2020 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/96a760f36e3511cac3bcc715faf543a9 to your computer and use it in GitHub Desktop.
Save productioncoder/96a760f36e3511cac3bcc715faf543a9 to your computer and use it in GitHub Desktop.
SideBarItem snapshot testing
import React from 'react';
import {shallow} from 'enzyme';
import {SideBarItem} from '../SideBarItem';
describe('SideBarItem', () => {
test('renders empty SideBarItem', () => {
const wrapper = shallow(
<SideBarItem/>
);
expect(wrapper).toMatchSnapshot();
});
test('renders highlighted SideBarItem that navigates to /feed/trending', () => {
const wrapper = shallow(
<SideBarItem highlighted icon='fire' label='Trending'/>
);
expect(wrapper).toMatchSnapshot();
});
test('render non-highlighted SideBarItem that navigates to /feed/trending', () => {
const wrapper = shallow(
<SideBarItem icon='fire' label='Trending'/>
);
expect(wrapper).toMatchSnapshot();
});
test('Renders highlighted SideBarItem with no navigation', () => {
const wrapper = shallow(
<SideBarItem highlighted icon='fire' label='Trending'/>
);
expect(wrapper).toMatchSnapshot();
});
}
@nisaji
Copy link

nisaji commented Dec 9, 2020

May be line 33 is not right.

@nisaji
Copy link

nisaji commented Dec 9, 2020

Sorry, latest commit fixed it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment