Skip to content

Commit

Permalink
Update Item component tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Tortolero committed Oct 20, 2018
1 parent 01cf4a5 commit 1a248a6
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions finished-application/frontend/__tests__/Item.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,27 @@ describe('<Item/>', () => {
const wrapper = shallow(<ItemComponent item={fakeItem} />);
expect(toJSON(wrapper)).toMatchSnapshot();
});
// it('renders the image properly', () => {
// const wrapper = shallow(<ItemComponent item={fakeItem} />);
// const img = wrapper.find('img');
// expect(img.props().src).toBe(fakeItem.image);
// expect(img.props().alt).toBe(fakeItem.title);
// });
// it('renders the pricetag and title', () => {
// const wrapper = shallow(<ItemComponent item={fakeItem} />);
// const PriceTag = wrapper.find('PriceTag');
// expect(PriceTag.children().text()).toBe('$50');
// expect(wrapper.find('Title a').text()).toBe(fakeItem.title);
// });
// it('renders out the buttons properly', () => {
// const wrapper = shallow(<ItemComponent item={fakeItem} />);
// const buttonList = wrapper.find('.buttonList');
// expect(buttonList.children()).toHaveLength(3);
// expect(buttonList.find('Link')).toHaveLength(1);
// expect(buttonList.find('AddToCart').exists()).toBe(true);
// expect(buttonList.find('DeleteItem').exists()).toBe(true);
// });

it('renders the image properly', () => {
const wrapper = shallow(<ItemComponent item={fakeItem} />);
const img = wrapper.find('img');
expect(img.props().src).toBe(fakeItem.image);
expect(img.props().alt).toBe(fakeItem.title);
});

it('renders the pricetag and title', () => {
const wrapper = shallow(<ItemComponent item={fakeItem} />);
const PriceTag = wrapper.find('PriceTag');
expect(PriceTag.children().text()).toBe('$40');
expect(wrapper.find('Title a').text()).toBe(fakeItem.title);
});

it('renders out the buttons properly', () => {
const wrapper = shallow(<ItemComponent item={fakeItem} />);
const buttonList = wrapper.find('.buttonList');
expect(buttonList.children()).toHaveLength(3);
expect(buttonList.find('Link')).toHaveLength(1);
expect(buttonList.find('AddToCart').exists()).toBe(true);
expect(buttonList.find('DeleteItem').exists()).toBe(true);
});
});

0 comments on commit 1a248a6

Please sign in to comment.