| |
@@ -0,0 +1,36 @@
|
| |
+ /* eslint-env jasmine, jest */
|
| |
+
|
| |
+ jest.unmock('../components/Icon.jsx');
|
| |
+
|
| |
+ import React from 'react';
|
| |
+ import ReactDOM from 'react-dom';
|
| |
+ import TestUtils from 'react-addons-test-utils';
|
| |
+
|
| |
+ import Icon from '../components/Icon.jsx';
|
| |
+
|
| |
+ describe('Icon', () => {
|
| |
+ const match = {
|
| |
+ link: 'https://pagure.io/fedora-hubs',
|
| |
+ secondary_icon: 'https://placekitten.com/g/200/300',
|
| |
+ };
|
| |
+
|
| |
+ it('has the correct link', () => {
|
| |
+ const component = TestUtils.renderIntoDocument(
|
| |
+ <Icon match={match} />
|
| |
+ );
|
| |
+ expect(component).toBeTruthy();
|
| |
+ const node = ReactDOM.findDOMNode(component);
|
| |
+ const link = node.querySelector('a');
|
| |
+ expect(link.getAttribute('href')).toEqual(match.link);
|
| |
+ });
|
| |
+ it('has the correct image source', () => {
|
| |
+ const component = TestUtils.renderIntoDocument(
|
| |
+ <Icon match={match} />
|
| |
+ );
|
| |
+ expect(component).toBeTruthy();
|
| |
+
|
| |
+ const node = ReactDOM.findDOMNode(component);
|
| |
+ const image = node.querySelector('img');
|
| |
+ expect(image.getAttribute('src')).toEqual(match.secondary_icon);
|
| |
+ });
|
| |
+ });
|
| |