react-map-gl/test/utils/style-utils.spec.js
Ib Green fa4ae3ffbb Buble+webpack2 (#169)
* Compile with buble and bundle with webpack
* Reduce number of dependencies
* Support for tree-shaking
* Standalone, easy-to-understand example with small package.json
* Tests now work under Node.js even when loading mapbox-gl.
* Fix travis config
2017-03-07 14:55:57 -08:00

37 lines
1.0 KiB
JavaScript

import test from 'tape-catch';
import Immutable from 'immutable';
import deepEqual from 'deep-equal';
import {getInteractiveLayerIds} from 'react-map-gl/utils/style-utils';
const TEST_STYLE_STRING = 'mapbox://styles/mapbox/streets-v9';
const TEST_STYLE_JS = {
layers: [
{
id: 'interactive',
interactive: true
}, {
id: 'non-interactive',
interactive: false
}
]
};
const TEST_STYLE_IMMUTABLE = Immutable.fromJS(TEST_STYLE_JS);
test('getInteractiveLayerIds#String style', t => {
const layers = getInteractiveLayerIds(TEST_STYLE_STRING);
t.equal(deepEqual(layers, []), true, 'got expected layer ids');
t.end();
});
test('getInteractiveLayerIds#JS style', t => {
const layers = getInteractiveLayerIds(TEST_STYLE_JS);
t.equal(deepEqual(layers, ['interactive']), true, 'got expected layer ids');
t.end();
});
test('getInteractiveLayerIds#Immutable style', t => {
const layers = getInteractiveLayerIds(TEST_STYLE_IMMUTABLE);
t.equal(deepEqual(layers, ['interactive']), true, 'got expected layer ids');
t.end();
});