This repository has been archived by the owner on Apr 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Frederic Lavigne
committed
Sep 9, 2016
1 parent
16a06a8
commit 2d356ec
Showing
1 changed file
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,71 @@ | ||
import React from 'react'; | ||
import test from 'ava'; | ||
import { shallow } from 'enzyme'; | ||
import Map from './Map'; | ||
|
||
test('(Component) Has expected elements.', t => { | ||
t.true(true); | ||
const testDistributionCenters = [ | ||
{ | ||
address: { | ||
city: 'Salt Lake City', | ||
state: 'Utah', | ||
country: 'US', | ||
latitude: 40.71, | ||
longitude: -111.90, | ||
}, | ||
contact: { | ||
name: 'Joseph Smith', | ||
}, | ||
}, | ||
]; | ||
|
||
const testRetailers = [ | ||
{ | ||
address: { | ||
city: 'Memphis', | ||
state: 'Tennessee', | ||
country: 'US', | ||
latitude: 35.19, | ||
longitude: -90.02, | ||
}, | ||
contact: { | ||
name: 'Joseph Smith', | ||
}, | ||
}, | ||
]; | ||
|
||
const testShipments = [ | ||
{ | ||
status: 'IN_TRANSIT', | ||
fromId: '3', | ||
toId: '204', | ||
currentLocation: { | ||
city: 'Albany', | ||
state: 'New York', | ||
country: 'US', | ||
latitude: 42.65, | ||
longitude: -73.75, | ||
}, | ||
estimatedTimeOfArrival: 'Thu, 28 Oct 2016', | ||
updatedAt: 'Thu, 27 Oct 2016 12:15:37 GMT', | ||
}, | ||
]; | ||
|
||
const setup = (someProps) => { | ||
const props = someProps; | ||
const component = shallow(<Map {...props} />); | ||
return { component, props }; | ||
}; | ||
|
||
test('(Component) Has no markers by default.', t => { | ||
const { component } = setup({}); | ||
t.is(component.find('MapMarker').length, 0); | ||
}); | ||
|
||
test('(Component) Has no markers by default.', t => { | ||
const { component } = setup({ | ||
distributionCenters: testDistributionCenters, | ||
retailers: testRetailers, | ||
shipments: testShipments, | ||
}); | ||
t.is(component.find('MapMarker').length, 3); | ||
}); |