diff --git a/src/__tests__/App.spec.js b/src/__tests__/App.spec.js
index a6b1f869..76ca95e8 100644
--- a/src/__tests__/App.spec.js
+++ b/src/__tests__/App.spec.js
@@ -1,10 +1,20 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import ReactDOM from 'react-dom';
+import Enzyme, { shallow } from 'enzyme';
+import Adapter from 'enzyme-adapter-react-16';
import App from '../App';
+Enzyme.configure({ adapter: new Adapter() });
+
describe('', () => {
- it('renders without crashing', () => {
- shallow();
- });
-});
+ it('it renders shallow without crashing', () => {
+ shallow()
+ });
+ it('state is initialized', () => {
+ const wrapper = shallow();
+ expect(wrapper.state().total).toBe('0');
+ expect(wrapper.state().next).toBeFalsy();
+ expect(wrapper.state().operation).toBeFalsy();
+ });
+});
\ No newline at end of file
diff --git a/src/__tests__/Button.spec.js b/src/__tests__/Button.spec.js
index f03654a0..14e1830d 100644
--- a/src/__tests__/Button.spec.js
+++ b/src/__tests__/Button.spec.js
@@ -1,10 +1,32 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import ReactDOM from 'react-dom';
+import Enzyme, { shallow } from 'enzyme';
+import Adapter from 'enzyme-adapter-react-16';
import Button from '../components/Button/Button';
+Enzyme.configure({ adapter: new Adapter() });
+
describe('', () => {
- it('renders without crashing', () => {
- shallow();
- });
+ it('renders without crashing', () => {
+ shallow();
+ });
+
+ it('renders div with orange', () => {
+ const wrapper = shallow();
+ const buttons = wrapper.find('.orange');
+ expect(buttons.length).toBe(1);
+ });
+
+ it('renders div with wide', () => {
+ const wrapper = shallow();
+ const buttons = wrapper.find('.wide');
+ expect(buttons.length).toBe(1);
+ });
+
+ it('renders button with prop name', () => {
+ const wrapper = shallow();
+ const buttons = wrapper.find('button');
+ expect(buttons.text()).toBe('abcd');
+ });
});
diff --git a/src/__tests__/Display.spec.js b/src/__tests__/Display.spec.js
index 223f25ab..ca0bf53b 100644
--- a/src/__tests__/Display.spec.js
+++ b/src/__tests__/Display.spec.js
@@ -7,4 +7,16 @@ describe('', () => {
it('renders without crashing', () => {
shallow();
});
-});
+
+ it('renders the display', () => {
+ const wrapper = shallow();
+ const display = wrapper.find('.component-display');
+ expect(display.length).toBe(1);
+ });
+
+ it('displays the prop', () => {
+ const wrapper = shallow();
+ const displayed = wrapper.find('.component-display > div');
+ expect(displayed.text()).toBe('test');
+ });
+});
\ No newline at end of file
diff --git a/src/__tests__/Panel.spec.js b/src/__tests__/Panel.spec.js
index 440a5abc..775c8077 100644
--- a/src/__tests__/Panel.spec.js
+++ b/src/__tests__/Panel.spec.js
@@ -1,10 +1,41 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import ReactDOM from 'react-dom';
+import Enzyme, { shallow, mount } from 'enzyme';
+import Adapter from 'enzyme-adapter-react-16';
import Panel from '../components/Panel/Panel';
+import App from '../App';
+
+Enzyme.configure({ adapter: new Adapter() });
describe('', () => {
- it('renders without crashing', () => {
- shallow();
- });
-});
+ it('renders without crashing', () => {
+ shallow();
+ });
+ it('renders within ', () => {
+ const wrapper = mount(
+
+
+
+ );
+ expect(wrapper.find('button').length).toBe(19);
+ expect(wrapper.find('.component-panel').length).toBe(1);
+ });
+ it('button changes state of App', () => {
+ const wrapper = mount(
+
+
+
+ );
+ wrapper
+ .find('button')
+ .filterWhere(btn => btn.text() === '7')
+ .simulate('click');
+ expect(wrapper.state().next).toBe('7');
+ wrapper
+ .find('button')
+ .filterWhere(btn => btn.text() === '9')
+ .simulate('click');
+ expect(wrapper.state().next).toBe('79');
+ });
+});
\ No newline at end of file