{"size": 1330, "ext": "js", "max_stars_repo_path": "__tests__/components/GridItem.test.js", "max_stars_repo_name": "radrow/Iris", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "__tests__/components/GridItem.test.js", "max_issues_repo_name": "radrow/Iris", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "__tests__/components/GridItem.test.js", "max_forks_repo_name": "radrow/Iris", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 39.1176470588, "max_line_length": 107, "alphanum_fraction": 0.6601503759}
import React from 'react';
import { BrowserRouter } from "react-router-dom";

// Testing-specific
import { shallow, mount, render } from 'enzyme';
const state = require('../state');

// Test subjects
import GridItem from '../../src/js/components/GridItem';

describe('<GridItem />', () => {

	it('should handle album', () => {
		var album = state.core.albums['jest:album:one'];
		var dom = shallow(<GridItem item={album} />);
		expect(dom.find('.grid__item__name').text()).toEqual('One');
		expect(dom.find('.grid__item__secondary__content').length).toBe(1);
	});

	it('should handle artist', () => {
		var artist = state.core.artists['jest:artist:alpha'];
		var dom = shallow(<GridItem item={artist} />);
		expect(dom.find('.grid__item__name').text()).toEqual('Alpha');
		expect(dom.find('.grid__item__secondary__content').childAt(0).render().text()).toEqual('123 followers');
		expect(dom.find('.grid__item__secondary__content').childAt(1).render().text()).toEqual('1 albums');
	});

	it('should handle playlist', () => {
		var playlist = state.core.playlists['jest:playlist:one'];
		var dom = shallow(<GridItem item={playlist} />);
		expect(dom.find('.grid__item__name').text()).toEqual('One');
		expect(dom.find('.grid__item__secondary__content').render().text()).toEqual('2 tracks');
	});
});