Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Link tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kmaschta committed Feb 29, 2016
1 parent 5a1b725 commit 477f679
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/frontend/js/product/ProductItem.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import chai, { assert } from 'chai';
import { assert } from 'chai';
import { shallow } from 'enzyme';
import chaiEnzyme from 'chai-enzyme';
import React from 'react';
import { Link } from 'react-router';

import '../test/setupJsdom';
import ProductItem from './ProductItem';

chai.use(chaiEnzyme());

describe('Component ProductItem', () => {
const props = {
id: 42,
Expand All @@ -34,6 +32,16 @@ describe('Component ProductItem', () => {

it('should display the correct thumbnail', () => {
const wrapper = shallow(<ProductItem {...props} />);
assert.deepEqual(wrapper.find('img').node.props.src, 'http://google.fr/image.jpg');
assert.deepEqual(wrapper.find('img').prop('src'), 'http://google.fr/image.jpg');
});

it('should contain correct product details link', () => {
const wrapper = shallow(<ProductItem {...props} />);
assert(wrapper.contains(<Link to={'/products/42'} className="card-link">Details</Link>));
});

it('should contain correct order link', () => {
const wrapper = shallow(<ProductItem {...props} />);
assert(wrapper.contains(<Link to={'/order/42'} className="card-link">Order</Link>));
});
});

0 comments on commit 477f679

Please sign in to comment.