Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
more and more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvennam987 committed Jan 25, 2017
1 parent ee955ac commit 22eff83
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 4 deletions.
19 changes: 19 additions & 0 deletions src/components/GhostButton/GhostButton.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import test from 'ava';
import React from 'react';
import { shallow } from 'enzyme';
import GhostButton from './GhostButton';

const setup = () => {
const spies = {
};
const props = {
};
const component = shallow(<GhostButton label="Ghost Button" />);

return { component, props, spies };
};

test('(Component) Has expected elements.', t => {
const { component } = setup();
t.is(component.find('RaisedButton').length, 1);
});
20 changes: 20 additions & 0 deletions src/components/GlobalNav/RoleSwitcher/RoleSwitcher.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import test from 'ava';
import React from 'react';
import { shallow } from 'enzyme';
import RoleSwitcher from './RoleSwitcher';

const setup = () => {
const spies = {
};
const props = {
};
const component = shallow(<RoleSwitcher />);

return { component, props, spies };
};

test('(Component) Has expected elements.', t => {
const { component } = setup();
t.is(component.find('div').length, 1);
t.is(component.find('LoadingSpinner').length, 1);
});
19 changes: 19 additions & 0 deletions src/components/LoadingSpinner/LoadingSpinner.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import test from 'ava';
import React from 'react';
import { shallow } from 'enzyme';
import LoadingSpinner from './LoadingSpinner';

const setup = () => {
const spies = {
};
const props = {
};
const component = shallow(<LoadingSpinner />);

return { component, props, spies };
};

test('(Component) Has expected elements.', t => {
const { component } = setup();
t.is(component.find('CircularProgress').length, 1);
});
30 changes: 30 additions & 0 deletions src/routes/Dashboard/components/Map/PopUpCard/PopUpCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,37 @@ const propsForDc = {
},
selectMarker: () => {},
};

const propsForStorm = {
dashboard: {
infoBox: {
type: 'storm',
data: {
id: 1,
},
},
shipments: [],
retailers: [],
storms: [
{
event: {
event_desc: 'Snow Storm',
lat: 38.89,
lon: -77.03,
radiusInKm: 800,
severity: 'Moderate',
},
},
],
},
selectMarker: () => {},
};
test('(Component) Renders a DC card', t => {
const component = shallow(<PopUpCard {...propsForDc} />);
t.is(component.find('DCCard').length, 1, 'has a DC Card');
});

test('(Component) Renders a Storm card', t => {
const component = shallow(<PopUpCard {...propsForStorm} />);
t.is(component.find('Connect(StormCard)').length, 1, 'has a Storm Card');
});
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,8 @@ StormCard.propTypes = {
storm: React.PropTypes.object.isRequired,
};

const mapStateToProps = () => ({
});

const mapActionCreators = {
acknowledgeRecommendation,
};

export default connect(mapStateToProps, mapActionCreators)(StormCard);
export default connect(() => {}, mapActionCreators)(StormCard);
19 changes: 19 additions & 0 deletions src/routes/Home/components/LandingPage/LandingPage.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import test from 'ava';
import React from 'react';
import { shallow } from 'enzyme';
import LandingPage from './LandingPage';

const setup = () => {
const spies = {
};
const props = {
};
const component = shallow(<LandingPage />);

return { component, props, spies };
};

test('(Component) Has expected elements.', t => {
const { component } = setup();
t.is(component.find('LogisticsWizard').length, 1);
});

0 comments on commit 22eff83

Please sign in to comment.