Skip to content

Commit

Permalink
Fix redbox require and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanmarks committed Jun 29, 2016
1 parent 62881d9 commit aec2409
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/AppContainer.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const React = require('react');
const deepForceUpdate = require('react-deep-force-update');
const Redbox = require('redbox-react');
const Redbox = require('redbox-react').default;
const { Component } = React;

class AppContainer extends Component {
Expand Down
11 changes: 10 additions & 1 deletion test/AppContainer/AppContainer.dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './setup';
import React, { Component } from 'react';
import expect, { createSpy } from 'expect';
import { mount } from 'enzyme';
import { mount, shallow } from 'enzyme';
import { mapProps } from 'recompose';

import AppContainer from '../../src/AppContainer.dev';
Expand Down Expand Up @@ -831,6 +831,15 @@ function runAllTests(useWeakMap) {
expect(wrapper.text()).toBe('new render + old state + 20');
});
});

describe('should use Redbox as the default errorReporter', () => {
const wrapper = shallow(<AppContainer><div>hey</div></AppContainer>);
const error = new Error('Something is wrong!');
wrapper.setState({error});
const errorReporter = wrapper.find('RedBox');
expect(errorReporter.length).toBe(1);
expect(errorReporter.prop('error')).toBe(error);
});
});
}

Expand Down

0 comments on commit aec2409

Please sign in to comment.