require('./testdom')('<html><body></body></html>');
import { assert } from 'chai';
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import App from '../src/components/app.jsx';

describe('<App />', function () {
  let el;
  const data = [
    { "name": "Aboleth" },
    { "name": "Acolyte" },
    { "name": "Adult Black Dragon" }
  ];

  beforeEach(function () {
    el = TestUtils.renderIntoDocument( React.createElement(App, { data }, null) );
  });

  it('It should have a default state.selectedMonster = null', function () {
    assert.isNull(el.state.selectedMonster);
  });

//  it('It should set a new monester when a valid key is given', function () {
//    el.setSelectedMonster(2);
//    assert.deepEqual(data[2], el.state.selectedMonster);
//  });

  it('It should set null if an invalid key is given', function () {
    el.setSelectedMonster(-1);
    assert.isNull(el.state.selectedMonster);
    el.setSelectedMonster(1000);
    assert.isNull(el.state.selectedMonster);
    el.setSelectedMonster('fred');
    assert.isNull(el.state.selectedMonster);
  });

});

@@ -261,30 +261,28 @@
 a = %5B%0A    %7B 
-%22
 name
-%22
 : %22Aboleth%22 
@@ -280,16 +280,31 @@
 Aboleth%22
+, arrayIndex: 0
  %7D,%0A    
@@ -301,30 +301,28 @@
  0 %7D,%0A    %7B 
-%22
 name
-%22
 : %22Acolyte%22 
@@ -320,16 +320,31 @@
 Acolyte%22
+, arrayIndex: 1
  %7D,%0A    
@@ -349,14 +349,12 @@
   %7B 
-%22
 name
-%22
 : %22A
@@ -371,16 +371,31 @@
  Dragon%22
+, arrayIndex: 2
  %7D%0A  %5D;%0A

Fix test data