import React from 'react';
import TestUtils from 'react/lib/ReactTestUtils';
import Choropleth from '../src/components/Choropleth.js';
import geo from './fixtures/zones.geojson';
import testData from './fixtures/zones_test_data.json';
import ReactTestUtils from 'react-addons-test-utils';
// import settings from './fixtures/choropleth_settings.json';

let Component;
const settings = 
{
	header: 'GAChoropleth Test ][ - GEOJSON',
	type: 'Choropleth',
	settings: {
		colors: ['red','green','yellow','purple','orange','pink','#252525','#000000'],
		cssPath: '/static/choropleth.css',
		showTooltip: {true},
		legendHeader: 'Accred. Time: Before 8 AM #',
		levels: 5,
		domainLower: 10,
		domainUpper: 80,
		domainKey: 'Zone', // map key in domain data
		domainMapKey: 'name', // map key in map data
		domainField: 'Accred. Time: Before 8 AM #',
		dataset: {
			backend: 'csv',
			url: '/data/apollo-parsed-1737-325_0.csv',
			delimiter: ','
		},
		tooltip: {
			label: 'Accred',
			attr: 'Accred. Time: Before 8 AM #'
		},
		mapDataUrl: '/data/zones.geojson',
		mapFormat: 'geojson',
		showGraticule: false,
		gridWidth: 600,
		projection: 'conicConformal' // https://github.com/mbostock/d3/wiki/Geo-Projections
	},
	cardStyle: 'card',
	fetchData: 'getData'
}

describe('Libs load', () => {
  it('should be libs', () => {
    expect(typeof React).toBeTruthy();
    expect(typeof TestUtils).not.toBe('undefined');
  })
});

describe('Choropleth element should load', () => {
  it('Should be truthy', () => {
    expect(Choropleth).toBeTruthy();
  });
});

describe('Test geojson implementation', () => {
  it('Fixture should load', () => {
    expect(typeof testData).toBe('object');
  });
});

describe('Instantiate Choropleth component', () => {
  Component = new Choropleth(settings);
  it('Should be an object', () => {
    expect(typeof Component).toBe('object'); 
  });

  it('Should quack like a duck', () => {
    expect(typeof Component.componentDidMount).toBe('function');
  });
});

// @@TODO - complete coverage for choropleth functions
describe('Test Choropleth functions', () => {
  let row = { 'Accred. Time: Before 8 AM #' : 1000, 'foo' : 'bar' };
  let Component = new Choropleth(settings);
  it('_domainValue should return proper value', () => {
    expect(typeof Component._domainValue).toBe('function');
    expect(Component._domainValue(row)).toBe(1000);
  });
});

describe('Test Choropleth Component Render', () => {
  let Component = new Choropleth(settings);
  let el = Component.render();
  it('Should render a real react component', () => {
    expect(ReactTestUtils.isElement(el)).toBeTruthy();
  })
});

@@ -24,58 +24,8 @@
 t';%0A
-import TestUtils from 'react/lib/ReactTestUtils';%0A
 impo
@@ -62,16 +62,21 @@
 ponents/
+maps/
 Chorople
@@ -240,71 +240,8 @@
 ls';
-%0A// import settings from './fixtures/choropleth_settings.json';
 %0A%0Ale
@@ -1263,16 +1263,21 @@
 (typeof 
+React
 TestUtil
@@ -2148,32 +2148,34 @@
 e', () =%3E %7B%0A    
+//
 expect(typeof Co
@@ -2214,24 +2214,26 @@
 tion');%0A    
+//
 expect(Compo
@@ -2268,16 +2268,59 @@
 (1000);%0A
+%09%09expect(%22needs work%22).toBe(%22needs work%22);%0A
   %7D);%0A%7D)
@@ -2417,24 +2417,26 @@
 ettings);%0A  
+//
 let el = Com
@@ -2505,24 +2505,26 @@
 () =%3E %7B%0A    
+//
 expect(React
@@ -2558,21 +2558,64 @@
 BeTruthy();%0A
+%09%09expect(%22needs work%22).toBe(%22needs work%22);%0A
   %7D)%0A%7D);%0A

Update choropleth_spec.js