forked from visgl/react-map-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map-spec.js
44 lines (35 loc) · 1.04 KB
/
map-spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import MapGL from '../src';
import React from 'react';
import ReactDOM from 'react-dom';
import document from 'global/document';
import test from 'tape-catch';
const mapboxApiAccessToken = process.env.MapboxAccessToken || process.env.MAPBOX_ACCESS_TOKEN; // eslint-disable-line
const defaultProps = {
width: 500,
height: 500,
longitude: -122,
latitude: 37,
zoom: 14,
mapboxApiAccessToken
};
test('MapGL can mount', t => {
t.ok(MapGL);
const reactContainer = document.createElement('div');
document.body.appendChild(reactContainer);
ReactDOM.render(<MapGL {...defaultProps} />, reactContainer);
t.ok(true);
t.end();
});
test('MapGL call onLoad when provided', t => {
const reactContainer = document.createElement('div');
document.body.appendChild(reactContainer);
function onLoad(...args) {
t.equal(args.length, 0, 'onLoad does not expose the map object.');
t.end();
}
const props = {...defaultProps, onLoad};
ReactDOM.render(<MapGL {...props} />, reactContainer);
if (!MapGL.supported()) {
t.end();
}
});