Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Style] run prettier and lint on tests (#968)

Shan He2d3bf001544c
diff --git a/examples/custom-reducer/src/app.js b/examples/custom-reducer/src/app.js
index f8dbd2da2..4269da8bc 100644
--- a/examples/custom-reducer/src/app.js
+++ b/examples/custom-reducer/src/app.js
@@ -67,7 +67,4 @@ class App extends Component {
const mapStateToProps = state => state;
const dispatchToProps = dispatch => ({dispatch});
-export default connect(
- mapStateToProps,
- dispatchToProps
-)(App);
+export default connect(mapStateToProps, dispatchToProps)(App);
diff --git a/examples/custom-theme/src/app.js b/examples/custom-theme/src/app.js
index 1e82ad9d3..304dda695 100644
--- a/examples/custom-theme/src/app.js
+++ b/examples/custom-theme/src/app.js
@@ -105,7 +105,4 @@ function App(props) {
const mapStateToProps = state => state;
const dispatchToProps = dispatch => ({dispatch});
-export default connect(
- mapStateToProps,
- dispatchToProps
-)(App);
+export default connect(mapStateToProps, dispatchToProps)(App);
diff --git a/examples/demo-app/src/app.js b/examples/demo-app/src/app.js
index 35290028e..40231360e 100644
--- a/examples/demo-app/src/app.js
+++ b/examples/demo-app/src/app.js
@@ -370,7 +370,4 @@ class App extends Component {
const mapStateToProps = state => state;
const dispatchToProps = dispatch => ({dispatch});
-export default connect(
- mapStateToProps,
- dispatchToProps
-)(App);
+export default connect(mapStateToProps, dispatchToProps)(App);
diff --git a/examples/node-app/src/app.js b/examples/node-app/src/app.js
index 0f7acbd0a..328a3b893 100644
--- a/examples/node-app/src/app.js
+++ b/examples/node-app/src/app.js
@@ -45,7 +45,4 @@ const App = () => (
const mapStateToProps = state => state;
const dispatchToProps = dispatch => ({dispatch});
-export default connect(
- mapStateToProps,
- dispatchToProps
-)(App);
+export default connect(mapStateToProps, dispatchToProps)(App);
diff --git a/examples/open-modal/src/app.js b/examples/open-modal/src/app.js
index 021708973..fe18513d4 100644
--- a/examples/open-modal/src/app.js
+++ b/examples/open-modal/src/app.js
@@ -93,7 +93,4 @@ class App extends Component {
const mapStateToProps = state => state;
const dispatchToProps = dispatch => ({dispatch});
-export default connect(
- mapStateToProps,
- dispatchToProps
-)(App);
+export default connect(mapStateToProps, dispatchToProps)(App);
diff --git a/examples/replace-component/src/app.js b/examples/replace-component/src/app.js
index 398281958..9b7573f6a 100644
--- a/examples/replace-component/src/app.js
+++ b/examples/replace-component/src/app.js
@@ -90,7 +90,4 @@ class App extends Component {
const mapStateToProps = state => state;
const dispatchToProps = dispatch => ({dispatch});
-export default connect(
- mapStateToProps,
- dispatchToProps
-)(App);
+export default connect(mapStateToProps, dispatchToProps)(App);
diff --git a/package.json b/package.json
index e3c1e6489..fd6ca2c1a 100644
--- a/package.json
+++ b/package.json
@@ -50,7 +50,8 @@
"prepublish": "uber-licence && yarn build && yarn build:umd",
"docs": "babel-node ./scripts/documentation.js",
"example-version": "babel-node ./scripts/edit-version.js",
- "lint": "eslint src webpack/*.js examples/*.js examples/**/src examples/**/*.js website/*.js website/src --fix",
+ "prettier-all": "prettier --write '{src,examples,test}/**/*.js'",
+ "lint": "eslint src test webpack examples/*.js examples/**/src website/*.js website/src --fix",
"web": "(yarn && yarn install:web && yarn start:web)",
"deploy": "yarn install:web && (cd website && yarn build)",
"clean": "rm -rf node_modules examples/**/node_modules website/node_modules",
diff --git a/src/components/common/datagrid.js b/src/components/common/datagrid.js
index 35c49880b..fd6a1e47d 100644
--- a/src/components/common/datagrid.js
+++ b/src/components/common/datagrid.js
@@ -160,9 +160,8 @@ function DataGridFactory(FieldHeader, Cell) {
};
columnsSelector = props => props.columns;
- hasGeojson = createSelector(
- this.columnsSelector,
- columns => columns.some(c => c.type === ALL_FIELD_TYPES.geojson)
+ hasGeojson = createSelector(this.columnsSelector, columns =>
+ columns.some(c => c.type === ALL_FIELD_TYPES.geojson)
);
_cellRenderer = ({columnIndex, key, rowIndex, style}) => {
diff --git a/src/components/common/field-selector.js b/src/components/common/field-selector.js
index c61b063fc..d5f4a6bb1 100644
--- a/src/components/common/field-selector.js
+++ b/src/components/common/field-selector.js
@@ -104,11 +104,8 @@ export default class FieldSelector extends Component {
filterFieldTypesSelector = props => props.filterFieldTypes;
showTokenSelector = props => props.showToken;
- selectedItemsSelector = createSelector(
- this.fieldsSelector,
- this.valueSelector,
- (fields, value) =>
- fields.filter(f => (Array.isArray(value) ? value : [value]).includes(defaultDisplayOption(f)))
+ selectedItemsSelector = createSelector(this.fieldsSelector, this.valueSelector, (fields, value) =>
+ fields.filter(f => (Array.isArray(value) ? value : [value]).includes(defaultDisplayOption(f)))
);
fieldOptionsSelector = createSelector(
@@ -123,10 +120,7 @@ export default class FieldSelector extends Component {
}
);
- fieldListItemSelector = createSelector(
- this.showTokenSelector,
- FieldListItemFactory
- );
+ fieldListItemSelector = createSelector(this.showTokenSelector, FieldListItemFactory);
render() {
return (
diff --git a/src/components/common/item-selector/typeahead.js b/src/components/common/item-selector/typeahead.js
index 067fcdbdb..79e6f0d3e 100644
--- a/src/components/common/item-selector/typeahead.js
+++ b/src/components/common/item-selector/typeahead.js
@@ -55,8 +55,7 @@ const InputBox = styled.div`
`;
const TypeaheadInput = styled.input`
- ${props => props.theme.secondaryInput}
- :hover {
+ ${props => props.theme.secondaryInput} :hover {
cursor: pointer;
background-color: ${props => props.theme.secondaryInputBgd};
}
diff --git a/src/components/common/range-plot.js b/src/components/common/range-plot.js
index b499e209a..9f499d971 100644
--- a/src/components/common/range-plot.js
+++ b/src/components/common/range-plot.js
@@ -60,10 +60,7 @@ export default class RangePlot extends Component {
};
domainSelector = props => props.lineChart && props.lineChart.xDomain;
- hintFormatter = createSelector(
- this.domainSelector,
- domain => getTimeWidgetHintFormatter(domain)
- );
+ hintFormatter = createSelector(this.domainSelector, domain => getTimeWidgetHintFormatter(domain));
onMouseMove = hoveredDP => {
this.setState({hoveredDP});
diff --git a/src/components/common/time-slider-marker.js b/src/components/common/time-slider-marker.js
index 14f84a00b..608d8d58a 100644
--- a/src/components/common/time-slider-marker.js
+++ b/src/components/common/time-slider-marker.js
@@ -83,15 +83,12 @@ export default class TimeSliderMarker extends Component {
domainSelector = props => props.domain;
widthSelector = props => props.width;
- scaleSelector = createSelector(
- this.domainSelector,
- this.widthSelector,
- (domain, width) =>
- Array.isArray(domain)
- ? scaleUtc()
- .domain(domain)
- .range([0, width])
- : null
+ scaleSelector = createSelector(this.domainSelector, this.widthSelector, (domain, width) =>
+ Array.isArray(domain)
+ ? scaleUtc()
+ .domain(domain)
+ .range([0, width])
+ : null
);
_updateAxis(scale) {
diff --git a/src/components/container.js b/src/components/container.js
index 8526f4964..283b17d30 100644
--- a/src/components/container.js
+++ b/src/components/container.js
@@ -142,10 +142,7 @@ export function ContainerFactory(KeplerGl) {
const mapStateToProps = (state, props) => ({state, ...props});
const dispatchToProps = dispatch => ({dispatch});
- return connect(
- mapStateToProps,
- dispatchToProps
- )(Container);
+ return connect(mapStateToProps, dispatchToProps)(Container);
}
// entryPoint
diff --git a/src/components/filters/time-widget.js b/src/components/filters/time-widget.js
index 1fecc7020..1f830313f 100644
--- a/src/components/filters/time-widget.js
+++ b/src/components/filters/time-widget.js
@@ -109,9 +109,8 @@ function TimeWidgetFactory(SpeedControl, TimeRangeFilter, FloatingTimeDisplay) {
};
fieldSelector = props => props.fields;
- yAxisFieldsSelector = createSelector(
- this.fieldSelector,
- fields => fields.filter(f => f.type === 'integer' || f.type === 'real')
+ yAxisFieldsSelector = createSelector(this.fieldSelector, fields =>
+ fields.filter(f => f.type === 'integer' || f.type === 'real')
);
_updateAnimationSpeed = speed => this.props.updateAnimationSpeed(this.props.index, speed);
diff --git a/src/components/index.js b/src/components/index.js
index 631f398bb..8abf38383 100644
--- a/src/components/index.js
+++ b/src/components/index.js
@@ -59,9 +59,7 @@ export {default as BrushConfigFactory} from './side-panel/interaction-panel/brus
export {default as TooltipConfigFactory} from './side-panel/interaction-panel/tooltip-config';
export {default as MapManagerFactory} from './side-panel/map-manager';
-export {
- default as LayerGroupSelectorFactory
-} from './side-panel/map-style-panel/map-layer-selector';
+export {default as LayerGroupSelectorFactory} from './side-panel/map-style-panel/map-layer-selector';
export {default as MapStyleSelectorFactory} from './side-panel/map-style-panel/map-style-selector';
export {default as CustomPanelsFactory} from './side-panel/custom-panel';
@@ -85,9 +83,7 @@ export {default as ExportMapModalFactory} from './modals/export-map-modal/export
export {default as AnimationControlFactory} from './common/animation-control/animation-control';
export {default as SpeedControlFactory} from './common/animation-control/speed-control';
export {default as AnimationPlaybacksFactory} from './common/animation-control/playback-controls';
-export {
- default as FloatingTimeDisplayFactory
-} from './common/animation-control/floating-time-display';
+export {default as FloatingTimeDisplayFactory} from './common/animation-control/floating-time-display';
// // Filters
export {default as TimeWidgetFactory} from './filters/time-widget';
diff --git a/src/components/kepler-gl.js b/src/components/kepler-gl.js
index d1c44f5a8..cab6bd5a4 100644
--- a/src/components/kepler-gl.js
+++ b/src/components/kepler-gl.js
@@ -139,17 +139,15 @@ function KeplerGlFactory(
/* selectors */
themeSelector = props => props.theme;
- availableThemeSelector = createSelector(
- this.themeSelector,
- theme =>
- typeof theme === 'object'
- ? {
- ...basicTheme,
- ...theme
- }
- : theme === THEME.light
- ? themeLT
- : theme
+ availableThemeSelector = createSelector(this.themeSelector, theme =>
+ typeof theme === 'object'
+ ? {
+ ...basicTheme,
+ ...theme
+ }
+ : theme === THEME.light
+ ? themeLT
+ : theme
);
availableProviders = createSelector(
@@ -404,27 +402,24 @@ const getDispatch = dispatch => dispatch;
const getUserActions = (dispatch, props) => props.actions || defaultUserActions;
function makeGetActionCreators() {
- return createSelector(
- [getDispatch, getUserActions],
- (dispatch, userActions) => {
- const [visStateActions, mapStateActions, mapStyleActions, uiStateActions, providerActions] = [
- VisStateActions,
- MapStateActions,
- MapStyleActions,
- UIStateActions,
- ProviderActions
- ].map(actions => bindActionCreators(mergeActions(actions, userActions), dispatch));
-
- return {
- visStateActions,
- mapStateActions,
- mapStyleActions,
- uiStateActions,
- providerActions,
- dispatch
- };
- }
- );
+ return createSelector([getDispatch, getUserActions], (dispatch, userActions) => {
+ const [visStateActions, mapStateActions, mapStyleActions, uiStateActions, providerActions] = [
+ VisStateActions,
+ MapStateActions,
+ MapStyleActions,
+ UIStateActions,
+ ProviderActions
+ ].map(actions => bindActionCreators(mergeActions(actions, userActions), dispatch));
+
+ return {
+ visStateActions,
+ mapStateActions,
+ mapStyleActions,
+ uiStateActions,
+ providerActions,
+ dispatch
+ };
+ });
}
function makeMapDispatchToProps() {
diff --git a/src/components/map-container.js b/src/components/map-container.js
index 955faa010..b04332dda 100644
--- a/src/components/map-container.js
+++ b/src/components/map-container.js
@@ -141,9 +141,8 @@ export default function MapContainerFactory(MapPopover, MapControl) {
);
filtersSelector = props => props.filters;
- polygonFilters = createSelector(
- this.filtersSelector,
- filters => filters.filter(f => f.type === FILTER_TYPES.polygon)
+ polygonFilters = createSelector(this.filtersSelector, filters =>
+ filters.filter(f => f.type === FILTER_TYPES.polygon)
);
mapboxLayersSelector = createSelector(
diff --git a/src/components/side-panel/common/source-data-selector.js b/src/components/side-panel/common/source-data-selector.js
index 818e76ce0..6e2c2cfec 100644
--- a/src/components/side-panel/common/source-data-selector.js
+++ b/src/components/side-panel/common/source-data-selector.js
@@ -36,14 +36,12 @@ export default function SourceDataSelectorFactory(DatasetTag) {
/* selectors */
/* eslint-disable no-invalid-this */
datasetsSelector = props => props.datasets;
- dsOptionsSelector = createSelector(
- this.datasetsSelector,
- datasets =>
- Object.values(datasets).map(ds => ({
- label: ds.label,
- value: ds.id,
- color: ds.color
- }))
+ dsOptionsSelector = createSelector(this.datasetsSelector, datasets =>
+ Object.values(datasets).map(ds => ({
+ label: ds.label,
+ value: ds.id,
+ color: ds.color
+ }))
);
render() {
diff --git a/src/components/side-panel/layer-manager.js b/src/components/side-panel/layer-manager.js
index 469133323..7ab0b65d9 100644
--- a/src/components/side-panel/layer-manager.js
+++ b/src/components/side-panel/layer-manager.js
@@ -134,17 +134,15 @@ function LayerManagerFactory(AddDataButton, LayerPanel, SourceDataCatalog) {
};
layerClassSelector = props => props.layerClasses;
- layerTypeOptionsSelector = createSelector(
- this.layerClassSelector,
- layerClasses =>
- Object.keys(layerClasses).map(key => {
- const layer = new layerClasses[key]();
- return {
- id: key,
- label: layer.name,
- icon: layer.layerIcon
- };
- })
+ layerTypeOptionsSelector = createSelector(this.layerClassSelector, layerClasses =>
+ Object.keys(layerClasses).map(key => {
+ const layer = new layerClasses[key]();
+ return {
+ id: key,
+ label: layer.name,
+ icon: layer.layerIcon
+ };
+ })
);
_addEmptyNewLayer = () => {
diff --git a/src/components/side-panel/layer-panel/custom-palette.js b/src/components/side-panel/layer-panel/custom-palette.js
index 3b34e8631..857a2ef49 100644
--- a/src/components/side-panel/layer-panel/custom-palette.js
+++ b/src/components/side-panel/layer-panel/custom-palette.js
@@ -170,27 +170,24 @@ class CustomPalette extends Component {
// derive sketcher position based on root component
showSketcherSelector = props => props.showSketcher;
themeSelector = props => props.theme;
- sketcherPosSelector = createSelector(
- this.showSketcherSelector,
- (showSketcher, theme = {}) => {
- const {defaultSketcherPos, bottomBuffer, sketcherHeight} = this.props;
- if (showSketcher === false || !this.root || !this.root.current) return defaultSketcherPos;
- const {sidePanelInnerPadding = 16, sidePanel = {}, sidePanelScrollBarWidth = 10} = theme;
- const sidePanelLeft = (sidePanel.margin || {}).left || 20;
- const offsetX = sidePanelInnerPadding + sidePanelLeft + sidePanelScrollBarWidth;
- // find component Root position
- const bounding = this.root.current.getBoundingClientRect();
- const {x, y, width} = bounding;
-
- // set the top so it won't collide with bottom widget
- const top =
- y + sketcherHeight <= window.innerHeight - bottomBuffer
- ? y
- : window.innerHeight - bottomBuffer - sketcherHeight;
-
- return {top: `${top}px`, left: `${x + width + offsetX}px`};
- }
- );
+ sketcherPosSelector = createSelector(this.showSketcherSelector, (showSketcher, theme = {}) => {
+ const {defaultSketcherPos, bottomBuffer, sketcherHeight} = this.props;
+ if (showSketcher === false || !this.root || !this.root.current) return defaultSketcherPos;
+ const {sidePanelInnerPadding = 16, sidePanel = {}, sidePanelScrollBarWidth = 10} = theme;
+ const sidePanelLeft = (sidePanel.margin || {}).left || 20;
+ const offsetX = sidePanelInnerPadding + sidePanelLeft + sidePanelScrollBarWidth;
+ // find component Root position
+ const bounding = this.root.current.getBoundingClientRect();
+ const {x, y, width} = bounding;
+
+ // set the top so it won't collide with bottom widget
+ const top =
+ y + sketcherHeight <= window.innerHeight - bottomBuffer
+ ? y
+ : window.innerHeight - bottomBuffer - sketcherHeight;
+
+ return {top: `${top}px`, left: `${x + width + offsetX}px`};
+ });
modalStylesSelector = createSelector(
this.themeSelector,
diff --git a/src/components/side-panel/layer-panel/custom-picker.js b/src/components/side-panel/layer-panel/custom-picker.js
index 6c56edde8..1cc9f123f 100644
--- a/src/components/side-panel/layer-panel/custom-picker.js
+++ b/src/components/side-panel/layer-panel/custom-picker.js
@@ -54,17 +54,14 @@ class CustomPicker extends Component {
};
themeSelector = props => props.theme;
- pickerStyleSelector = createSelector(
- this.themeSelector,
- theme => ({
- picker: {
- width: '200px',
- padding: '10px 10px 8px',
- boxSizing: 'initial',
- background: theme.panelBackground
- }
- })
- );
+ pickerStyleSelector = createSelector(this.themeSelector, theme => ({
+ picker: {
+ width: '200px',
+ padding: '10px 10px 8px',
+ boxSizing: 'initial',
+ background: theme.panelBackground
+ }
+ }));
handleClickOutside = e => {
this.props.onSwatchClose();
diff --git a/src/connect/keplergl-connect.js b/src/connect/keplergl-connect.js
index abe2cabf1..643cb08f2 100644
--- a/src/connect/keplergl-connect.js
+++ b/src/connect/keplergl-connect.js
@@ -35,9 +35,12 @@ export const connect = (
const reduxMapDispatch = (dispatch, props) => mapDispatchToProps(props.dispatch, props, dispatch);
- const ReduxComponent = reduxConnect(reduxMapState, reduxMapDispatch, reduxMergeProps, options)(
- BaseComponent
- );
+ const ReduxComponent = reduxConnect(
+ reduxMapState,
+ reduxMapDispatch,
+ reduxMergeProps,
+ options
+ )(BaseComponent);
// save selector to context so it can be accessed by its children
return withLocalSelector(ReduxComponent);
diff --git a/src/connect/with-local-selector.js b/src/connect/with-local-selector.js
index 6a54982ef..3d5b74038 100644
--- a/src/connect/with-local-selector.js
+++ b/src/connect/with-local-selector.js
@@ -44,14 +44,10 @@ const withLocalSelector = ParentComponent => {
this.selectorFromProps,
(ctx, props) => mergeSelectors(ctx, props)
);
- contextSelector = createSelector(
- this.computedSelector,
- this.idFromProps,
- (selector, id) => ({
- selector,
- id
- })
- );
+ contextSelector = createSelector(this.computedSelector, this.idFromProps, (selector, id) => ({
+ selector,
+ id
+ }));
render() {
const computedContext = this.contextSelector(this.props, this.context);
diff --git a/src/constants/default-settings.js b/src/constants/default-settings.js
index d9aeeaea2..f5ab1479b 100644
--- a/src/constants/default-settings.js
+++ b/src/constants/default-settings.js
@@ -246,7 +246,11 @@ export const ICON_FIELDS = {
icon: ['icon']
};
-export const TRIP_POINT_FIELDS = [['lat', 'lng'], ['lat', 'lon'], ['latitude', 'longitude']];
+export const TRIP_POINT_FIELDS = [
+ ['lat', 'lng'],
+ ['lat', 'lon'],
+ ['latitude', 'longitude']
+];
export const TRIP_ARC_FIELDS = {
lat0: 'begintrip',
diff --git a/src/layers/aggregation-layer.js b/src/layers/aggregation-layer.js
index b1a7270c2..e1f2c62f9 100644
--- a/src/layers/aggregation-layer.js
+++ b/src/layers/aggregation-layer.js
@@ -33,7 +33,10 @@ export const pointPosResolver = ({lat, lng}) => `${lat.fieldIdx}-${lng.fieldIdx}
export const getValueAggrFunc = (field, aggregation) => {
return points => {
return field
- ? aggregate(points.map(p => p.data[field.tableFieldIndex - 1]), aggregation)
+ ? aggregate(
+ points.map(p => p.data[field.tableFieldIndex - 1]),
+ aggregation
+ )
: points.length;
};
};
diff --git a/src/layers/h3-hexagon-layer/h3-hexagon-layer.js b/src/layers/h3-hexagon-layer/h3-hexagon-layer.js
index bb640fece..628994c9e 100644
--- a/src/layers/h3-hexagon-layer/h3-hexagon-layer.js
+++ b/src/layers/h3-hexagon-layer/h3-hexagon-layer.js
@@ -167,7 +167,11 @@ export default class HexagonIdLayer extends Layer {
// color
const cScale =
colorField &&
- this.getVisChannelScale(colorScale, colorDomain, colorRange.colors.map(c => hexToRgb(c)));
+ this.getVisChannelScale(
+ colorScale,
+ colorDomain,
+ colorRange.colors.map(c => hexToRgb(c))
+ );
// height
const sScale = sizeField && this.getVisChannelScale(sizeScale, sizeDomain, sizeRange, 0);
diff --git a/src/layers/mapboxgl-layer.js b/src/layers/mapboxgl-layer.js
index 42c04044b..b84ce45dc 100644
--- a/src/layers/mapboxgl-layer.js
+++ b/src/layers/mapboxgl-layer.js
@@ -65,9 +65,8 @@ class MapboxLayerGL extends Layer {
(datasetId, columns) => `${datasetId}-${columns}`
);
- filterSelector = createSelector(
- this.gpuFilterSelector,
- gpuFilter => gpuFilterToMapboxFilter(gpuFilter)
+ filterSelector = createSelector(this.gpuFilterSelector, gpuFilter =>
+ gpuFilterToMapboxFilter(gpuFilter)
);
isValidFilter(filter) {
diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.js
index c2e0445fe..f3650360e 100644
--- a/src/reducers/vis-state-updaters.js
+++ b/src/reducers/vis-state-updaters.js
@@ -567,7 +567,12 @@ export function setFilterUpdater(state, action) {
const layerDataIds = uniq(
layerIdDifference
- .map(lid => get(state.layers.find(l => l.id === lid), ['config', 'dataId']))
+ .map(lid =>
+ get(
+ state.layers.find(l => l.id === lid),
+ ['config', 'dataId']
+ )
+ )
.filter(d => d)
);
@@ -577,7 +582,12 @@ export function setFilterUpdater(state, action) {
// Update newFilter dataIds
const newDataIds = uniq(
newFilter.layerId
- .map(lid => get(state.layers.find(l => l.id === lid), ['config', 'dataId']))
+ .map(lid =>
+ get(
+ state.layers.find(l => l.id === lid),
+ ['config', 'dataId']
+ )
+ )
.filter(d => d)
);
diff --git a/src/utils/filter-utils.js b/src/utils/filter-utils.js
index 5cbc87565..75a3461a5 100644
--- a/src/utils/filter-utils.js
+++ b/src/utils/filter-utils.js
@@ -387,7 +387,10 @@ export const getPolygonFilterFunctor = (layer, filter) => {
const pos = getPosition({data});
return (
pos.every(Number.isFinite) &&
- [[pos[0], pos[1]], [pos[3], pos[4]]].every(point => isInPolygon(point, filter.value))
+ [
+ [pos[0], pos[1]],
+ [pos[3], pos[4]]
+ ].every(point => isInPolygon(point, filter.value))
);
};
default:
diff --git a/test/browser/components/common/color-legend-test.js b/test/browser/components/common/color-legend-test.js
index 134c32e16..0c769a1fa 100644
--- a/test/browser/components/common/color-legend-test.js
+++ b/test/browser/components/common/color-legend-test.js
@@ -33,14 +33,7 @@ test('Components -> ColorLegend.render', t => {
const fieldType = 'real';
const domain = [0, 20];
const scaleType = 'quantize';
- const range = [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ];
+ const range = ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300'];
const displayLabel = true;
const props = {
@@ -81,7 +74,7 @@ test('Components -> ColorLegend.render', t => {
.find('text')
.at(0)
.text();
- t.equal(row1Txt, '', 'should not render text')
+ t.equal(row1Txt, '', 'should not render text');
t.end();
});
diff --git a/test/browser/components/common/file-uploader-test.js b/test/browser/components/common/file-uploader-test.js
index ffd4f0d04..fb69113c8 100644
--- a/test/browser/components/common/file-uploader-test.js
+++ b/test/browser/components/common/file-uploader-test.js
@@ -23,9 +23,7 @@ import test from 'tape';
import sinon from 'sinon';
import {mountWithTheme} from 'test/helpers/component-utils';
-import FileUplad, {
- WarningMsg
-} from 'components/common/file-uploader/file-upload';
+import FileUplad, {WarningMsg} from 'components/common/file-uploader/file-upload';
import FileDrop from 'components/common/file-uploader/file-drop';
import UploadButton from 'components/common/file-uploader/upload-button';
@@ -69,7 +67,6 @@ test('Components -> FileUpload.onDrop', t => {
const files = wrapper.state().files;
t.deepEqual(files, mockFiles, 'should set files to state');
- const uploadMsg = wrapper.find('.file-uploader__message');
t.end();
});
@@ -80,9 +77,7 @@ test('Components -> FileUpload.onDrop -> render loading msg', t => {
t.deepEqual(arg, mockFiles, 'should call onFileUpload with files');
});
- const wrapper = mountWithTheme(
- <FileUplad onFileUpload={onFileUpload} fileLoading />
- );
+ const wrapper = mountWithTheme(<FileUplad onFileUpload={onFileUpload} fileLoading />);
const FileDropDiv = wrapper.find('.file-uploader__file-drop').at(0);
// mock file drop event
@@ -196,7 +191,7 @@ test('Components -> UploadButton fileInput', t => {
// simulate click
uploadButton.find('.file-upload__upload-button-span').simulate('click');
-
+
// mock file drop event
const mockEvent = {
target: {
@@ -215,4 +210,4 @@ test('Components -> UploadButton fileInput', t => {
t.deepEqual(files, mockFiles, 'should set files to state');
t.end();
-});
\ No newline at end of file
+});
diff --git a/test/browser/components/container-test.js b/test/browser/components/container-test.js
index d1324d800..80c48eaef 100644
--- a/test/browser/components/container-test.js
+++ b/test/browser/components/container-test.js
@@ -73,13 +73,18 @@ test('Components -> Container -> Mount with mint:true', t => {
let actions = store.getActions();
- let expectedActions0 = {type: '@@kepler.gl/REGISTER_ENTRY', payload: {id: 'map', mint: true, mapboxApiAccessToken: undefined, mapboxApiUrl: undefined, mapStylesReplaceDefault: undefined}};
+ let expectedActions0 = {
+ type: '@@kepler.gl/REGISTER_ENTRY',
+ payload: {
+ id: 'map',
+ mint: true,
+ mapboxApiAccessToken: undefined,
+ mapboxApiUrl: undefined,
+ mapStylesReplaceDefault: undefined
+ }
+ };
- t.deepEqual(
- actions,
- [expectedActions0],
- 'should register entry and request map style'
- );
+ t.deepEqual(actions, [expectedActions0], 'should register entry and request map style');
// dispatch register action to reducer
let nextState = appReducer({}, expectedActions0);
@@ -89,11 +94,7 @@ test('Components -> Container -> Mount with mint:true', t => {
}
};
- t.deepEqual(
- nextState,
- expectedState,
- 'should register map to root reducer by default'
- );
+ t.deepEqual(nextState, expectedState, 'should register map to root reducer by default');
// mount with custom state
store = mockStore({smoothie: {}});
@@ -111,20 +112,29 @@ test('Components -> Container -> Mount with mint:true', t => {
t.doesNotThrow(() => {
wrapper = mount(
<Provider store={store}>
- <Container getState={s => s.smoothie} id={testId.id} mapboxApiAccessToken={testId.mapboxApiAccessToken}/>
+ <Container
+ getState={s => s.smoothie}
+ id={testId.id}
+ mapboxApiAccessToken={testId.mapboxApiAccessToken}
+ />
</Provider>
);
}, 'Should not throw error when mount');
actions = store.getActions();
- expectedActions0 = {type: '@@kepler.gl/REGISTER_ENTRY', payload: {id: 'milkshake', mint: true, mapboxApiAccessToken: 'pk.smoothie', mapboxApiUrl: undefined, mapStylesReplaceDefault: undefined}};
+ expectedActions0 = {
+ type: '@@kepler.gl/REGISTER_ENTRY',
+ payload: {
+ id: 'milkshake',
+ mint: true,
+ mapboxApiAccessToken: 'pk.smoothie',
+ mapboxApiUrl: undefined,
+ mapStylesReplaceDefault: undefined
+ }
+ };
- t.deepEqual(
- actions,
- [expectedActions0],
- 'should register entry and request map style'
- );
+ t.deepEqual(actions, [expectedActions0], 'should register entry and request map style');
actions.splice(0, 2);
nextState = appReducer({}, expectedActions0);
@@ -140,11 +150,7 @@ test('Components -> Container -> Mount with mint:true', t => {
}
};
- t.deepEqual(
- nextState,
- expectedState,
- 'should register milkshake to root reducer'
- );
+ t.deepEqual(nextState, expectedState, 'should register milkshake to root reducer');
// unmount
wrapper.unmount();
@@ -157,11 +163,7 @@ test('Components -> Container -> Mount with mint:true', t => {
expectedState = {
smoothie: {}
};
- t.deepEqual(
- nextState,
- expectedState,
- 'should delete milkshake from root reducer'
- );
+ t.deepEqual(nextState, expectedState, 'should delete milkshake from root reducer');
spy.restore();
t.end();
@@ -185,20 +187,30 @@ test('Components -> Container -> Mount with mint:false', t => {
t.doesNotThrow(() => {
wrapper = mount(
<Provider store={store}>
- <Container getState={s => s.smoothie} id={testId.id} mint={false} mapboxApiAccessToken="hello.world"/>
+ <Container
+ getState={s => s.smoothie}
+ id={testId.id}
+ mint={false}
+ mapboxApiAccessToken="hello.world"
+ />
</Provider>
);
}, 'Should not throw error when mount');
let actions = store.getActions();
- const expectedActions0 = {type: '@@kepler.gl/REGISTER_ENTRY', payload: {id: 'milkshake', mint: false, mapboxApiAccessToken: 'hello.world', mapboxApiUrl: undefined, mapStylesReplaceDefault: undefined}};
+ const expectedActions0 = {
+ type: '@@kepler.gl/REGISTER_ENTRY',
+ payload: {
+ id: 'milkshake',
+ mint: false,
+ mapboxApiAccessToken: 'hello.world',
+ mapboxApiUrl: undefined,
+ mapStylesReplaceDefault: undefined
+ }
+ };
- t.deepEqual(
- actions,
- [expectedActions0],
- 'should register entry and request map style'
- );
+ t.deepEqual(actions, [expectedActions0], 'should register entry and request map style');
actions.splice(0, 2);
const nextState = appReducer({}, expectedActions0);
@@ -215,11 +227,7 @@ test('Components -> Container -> Mount with mint:false', t => {
}
}
};
- t.deepEqual(
- nextState,
- expectedState,
- 'should register milkshake to root reducer'
- );
+ t.deepEqual(nextState, expectedState, 'should register milkshake to root reducer');
// unmount
wrapper.unmount();
@@ -258,13 +266,18 @@ test('Components -> Container -> Mount then rename', t => {
);
}, 'Should not throw error when mount');
- const expectedActions0 = {type: '@@kepler.gl/REGISTER_ENTRY', payload: {id: 'milkshake', mint: true, mapboxApiAccessToken: 'hello.world', mapboxApiUrl: undefined, mapStylesReplaceDefault: undefined}};
+ const expectedActions0 = {
+ type: '@@kepler.gl/REGISTER_ENTRY',
+ payload: {
+ id: 'milkshake',
+ mint: true,
+ mapboxApiAccessToken: 'hello.world',
+ mapboxApiUrl: undefined,
+ mapStylesReplaceDefault: undefined
+ }
+ };
- t.deepEqual(
- store.getActions().pop(),
- expectedActions0,
- 'should register entry'
- );
+ t.deepEqual(store.getActions().pop(), expectedActions0, 'should register entry');
const nextState = appReducer({}, expectedActions0);
const expectedState = {
@@ -279,11 +292,7 @@ test('Components -> Container -> Mount then rename', t => {
}
}
};
- t.deepEqual(
- nextState,
- expectedState,
- 'should register milkshake to root reducer'
- );
+ t.deepEqual(nextState, expectedState, 'should register milkshake to root reducer');
wrapper.setProps({id: 'milkshake-2'});
// actions = store.getActions();
@@ -292,11 +301,7 @@ test('Components -> Container -> Mount then rename', t => {
payload: {oldId: 'milkshake', newId: 'milkshake-2'}
};
- t.deepEqual(
- store.getActions().pop(),
- expectedActions1,
- 'should rename entry'
- );
+ t.deepEqual(store.getActions().pop(), expectedActions1, 'should rename entry');
const nextState1 = appReducer(nextState, expectedActions1);
const expectedState1 = {
@@ -305,21 +310,13 @@ test('Components -> Container -> Mount then rename', t => {
}
};
- t.deepEqual(
- nextState1,
- expectedState1,
- 'should rename milkshake to milkshake-2'
- );
+ t.deepEqual(nextState1, expectedState1, 'should rename milkshake to milkshake-2');
// unmount
wrapper.unmount();
const expectedActions2 = {type: '@@kepler.gl/DELETE_ENTRY', payload: 'milkshake-2'};
- t.deepEqual(
- store.getActions().pop(),
- expectedActions2,
- 'should call unmount milkshake-2'
- );
+ t.deepEqual(store.getActions().pop(), expectedActions2, 'should call unmount milkshake-2');
t.end();
});
diff --git a/test/browser/components/editor/feature-action-panel-test.js b/test/browser/components/editor/feature-action-panel-test.js
index 359b3be15..5a3c96b78 100644
--- a/test/browser/components/editor/feature-action-panel-test.js
+++ b/test/browser/components/editor/feature-action-panel-test.js
@@ -42,7 +42,7 @@ test('FeatureActionPanel -> display layers', t => {
const datasets = {
puppy: {
- color: [123,123,123]
+ color: [123, 123, 123]
}
};
@@ -59,12 +59,7 @@ test('FeatureActionPanel -> display layers', t => {
/>
);
- t.equal(
- $.find('.layer-panel-item').length,
- 2,
- 'We should display only 2 action panel items'
- );
+ t.equal($.find('.layer-panel-item').length, 2, 'We should display only 2 action panel items');
t.end();
-
});
diff --git a/test/browser/components/editor/feature-styles-test.js b/test/browser/components/editor/feature-styles-test.js
index cbd699815..254fcf362 100644
--- a/test/browser/components/editor/feature-styles-test.js
+++ b/test/browser/components/editor/feature-styles-test.js
@@ -44,13 +44,16 @@ test('FeatureStyles - getStyles point', t => {
);
t.deepEqual(
- getStyle({feature: {
+ getStyle({
+ feature: {
...feature,
properties: {
...feature.properties,
isVisible: false
}
- }, state: RenderStates.INACTIVE}),
+ },
+ state: RenderStates.INACTIVE
+ }),
{
stroke: '#26B5F2',
strokeWidth: 0,
@@ -65,7 +68,6 @@ test('FeatureStyles - getStyles point', t => {
});
test('FeatureStyles - getStyles line-string', t => {
-
const feature = {
properties: {
isVisible: true,
@@ -86,13 +88,16 @@ test('FeatureStyles - getStyles line-string', t => {
);
t.deepEqual(
- getStyle({feature: {
+ getStyle({
+ feature: {
...feature,
properties: {
...feature.properties,
isVisible: false
}
- }, state: RenderStates.INACTIVE}),
+ },
+ state: RenderStates.INACTIVE
+ }),
{
stroke: '#26B5F2',
strokeWidth: 0,
@@ -104,4 +109,3 @@ test('FeatureStyles - getStyles line-string', t => {
);
t.end();
});
-
diff --git a/test/browser/components/index.js b/test/browser/components/index.js
index 1ea87c15b..9dff049b5 100644
--- a/test/browser/components/index.js
+++ b/test/browser/components/index.js
@@ -35,4 +35,3 @@ import './side-panel';
import './common';
import './editor';
import './map-container-test';
-
diff --git a/test/browser/components/injector-test.js b/test/browser/components/injector-test.js
index a30b99d38..827c97f74 100644
--- a/test/browser/components/injector-test.js
+++ b/test/browser/components/injector-test.js
@@ -26,11 +26,7 @@ import {Provider} from 'react-redux';
import sinon from 'sinon';
import {console as Console} from 'global/window';
-import {
- withState,
- injectComponents,
- PanelHeaderFactory
-} from 'components';
+import {withState, injectComponents, PanelHeaderFactory} from 'components';
import coreReducer from 'reducers/core';
import {keplerGlInit} from 'actions/actions';
@@ -43,9 +39,7 @@ test('Components -> injector -> injectComponents', t => {
const CustomHeader = () => <div className="my-test-header">smoothie</div>;
const myCustomHeaderFactory = () => CustomHeader;
- const KeplerGl = injectComponents([
- [PanelHeaderFactory, myCustomHeaderFactory]
- ]);
+ const KeplerGl = injectComponents([[PanelHeaderFactory, myCustomHeaderFactory]]);
// assume instance reducer is already mounted
const store = mockStore({
@@ -68,9 +62,7 @@ test('Components -> injector -> injectComponents', t => {
test('Components -> injector -> missing deps', t => {
const spy = sinon.spy(Console, 'error');
- const myCustomNameFactory = () => () => (
- <div className="my-test-header-name">name</div>
- );
+ const myCustomNameFactory = () => () => <div className="my-test-header-name">name</div>;
const myCustomHeaderFactory = Name => () => (
<div className="my-test-header-1">
<Name />
@@ -79,9 +71,7 @@ test('Components -> injector -> missing deps', t => {
);
myCustomHeaderFactory.deps = [myCustomNameFactory];
- const KeplerGl = injectComponents([
- [PanelHeaderFactory, myCustomHeaderFactory]
- ]);
+ const KeplerGl = injectComponents([[PanelHeaderFactory, myCustomHeaderFactory]]);
// assume instance reducer is already mounted
const store = mockStore({
@@ -96,15 +86,9 @@ test('Components -> injector -> missing deps', t => {
</Provider>
);
- t.ok(
- spy.notCalled,
- 'Should automatically add custom deps and not call console.error'
- );
+ t.ok(spy.notCalled, 'Should automatically add custom deps and not call console.error');
- t.ok(
- wrapper.find('.my-test-header-name').length,
- 'should still render custom header name'
- );
+ t.ok(wrapper.find('.my-test-header-name').length, 'should still render custom header name');
spy.restore();
t.end();
@@ -143,10 +127,7 @@ test('Components -> injector -> wrong factory type', t => {
);
// test if custom header is rendered
- t.ok(
- wrapper.find('.side-panel__panel-header').length,
- 'should render default header'
- );
+ t.ok(wrapper.find('.side-panel__panel-header').length, 'should render default header');
spy.restore();
t.end();
@@ -179,10 +160,7 @@ test('Components -> injector -> wrong replacement type', t => {
);
// test if custom header is rendered
- t.ok(
- wrapper.find('.side-panel__panel-header').length,
- 'should render default header'
- );
+ t.ok(wrapper.find('.side-panel__panel-header').length, 'should render default header');
spy.restore();
t.end();
@@ -193,16 +171,14 @@ test('Components -> injector -> replace and render existing', t => {
function myCustomHeaderFactory(...deps) {
const PanelHeader = PanelHeaderFactory(...deps);
- PanelHeader.defaultProps
+ PanelHeader.defaultProps;
const MyHeader = props => {
return <PanelHeader {...props} appName="taro" />;
};
return MyHeader;
}
- const KeplerGl = injectComponents([
- [PanelHeaderFactory, myCustomHeaderFactory]
- ]);
+ const KeplerGl = injectComponents([[PanelHeaderFactory, myCustomHeaderFactory]]);
// assume instance reducer is already mounted
const store = mockStore({
keplerGl: {
@@ -224,17 +200,11 @@ test('Components -> injector -> replace and render existing', t => {
});
test('Components -> injector -> withState.lens', t => {
- const CustomHeader = ({visState}) => (
- <div className="my-test-header-3">smoothie</div>
- );
+ const CustomHeader = ({visState}) => <div className="my-test-header-3">smoothie</div>;
const myCustomHeaderFactory = () =>
- withState([visStateLens, mapStateLens, uiStateLens, mapStyleLens])(
- CustomHeader
- );
+ withState([visStateLens, mapStateLens, uiStateLens, mapStyleLens])(CustomHeader);
- const KeplerGl = injectComponents([
- [PanelHeaderFactory, myCustomHeaderFactory]
- ]);
+ const KeplerGl = injectComponents([[PanelHeaderFactory, myCustomHeaderFactory]]);
// assume instance reducer is already mounted
const store = mockStore({
@@ -263,15 +233,11 @@ test('Components -> injector -> withState.lens', t => {
});
test('Components -> injector -> withState.mapStateToProps', t => {
- const CustomHeader = ({visState}) => (
- <div className="my-test-header-3">smoothie</div>
- );
+ const CustomHeader = ({visState}) => <div className="my-test-header-3">smoothie</div>;
const myCustomHeaderFactory = () =>
withState([], state => ({ids: Object.keys(state)}))(CustomHeader);
- const KeplerGl = injectComponents([
- [PanelHeaderFactory, myCustomHeaderFactory]
- ]);
+ const KeplerGl = injectComponents([[PanelHeaderFactory, myCustomHeaderFactory]]);
// assume instance reducer is already mounted
const store = mockStore({
@@ -308,9 +274,7 @@ test('Components -> injector -> actions', t => {
const myCustomHeaderFactory = () =>
withState([], state => state, {add: testAction})(CustomHeader);
- const KeplerGl = injectComponents([
- [PanelHeaderFactory, myCustomHeaderFactory]
- ]);
+ const KeplerGl = injectComponents([[PanelHeaderFactory, myCustomHeaderFactory]]);
// assume instance reducer is already mounted
const store = mockStore({
diff --git a/test/browser/components/kepler-gl-test.js b/test/browser/components/kepler-gl-test.js
index 1625dba12..bde4fc602 100644
--- a/test/browser/components/kepler-gl-test.js
+++ b/test/browser/components/kepler-gl-test.js
@@ -62,7 +62,6 @@ const initialState = {
const mockStore = configureStore();
test('Components -> KeplerGl -> Mount', t => {
-
// mount with empty store
const store = mockStore(initialState);
let wrapper;
@@ -92,7 +91,6 @@ test('Components -> KeplerGl -> Mount', t => {
});
test('Components -> KeplerGl -> Mount -> readOnly', t => {
-
// mount with readOnly true
const initialStateReadonly = {
keplerGl: {
@@ -134,7 +132,6 @@ test('Components -> KeplerGl -> Mount -> readOnly', t => {
});
test('Components -> KeplerGl -> Mount -> Plot', t => {
-
// mount with readOnly true
const initialStatePlots = {
keplerGl: {
@@ -183,10 +180,7 @@ test('Components -> KeplerGl -> Mount -> Split Maps', t => {
...initialCoreState,
visState: {
...initialCoreState.visState,
- splitMaps: [
- {layers: {}},
- {layers: {}}
- ]
+ splitMaps: [{layers: {}}, {layers: {}}]
}
}
}
@@ -222,10 +216,9 @@ test('Components -> KeplerGl -> Mount -> Split Maps', t => {
test('Components -> KeplerGl -> Mount -> Load default map style task', t => {
// mount with empty store
const store = mockStore(initialState);
- let wrapper;
t.doesNotThrow(() => {
- wrapper = mount(
+ mount(
<Provider store={store}>
<KeplerGl
id="map"
@@ -242,10 +235,7 @@ test('Components -> KeplerGl -> Mount -> Load default map style task', t => {
{type: ActionTypes.LOAD_MAP_STYLES, payload: {}},
{
type: ActionTypes.REQUEST_MAP_STYLES,
- payload: DEFAULT_MAP_STYLES.reduce(
- (accu, curr) => ({...accu, [curr.id]: curr}),
- {}
- )
+ payload: DEFAULT_MAP_STYLES.reduce((accu, curr) => ({...accu, [curr.id]: curr}), {})
},
{type: ActionTypes.UPDATE_MAP, payload: {width: 800, height: 800}}
];
@@ -284,11 +274,7 @@ test('Components -> KeplerGl -> Mount -> Load default map style task', t => {
]
};
- t.deepEqual(
- task1.payload,
- expectedTask.payload,
- 'should create task to load map styles'
- );
+ t.deepEqual(task1.payload, expectedTask.payload, 'should create task to load map styles');
t.deepEqual(resultState1, initialCoreState, 'state should be the same');
const resultState2 = coreReducer(
@@ -333,7 +319,6 @@ test('Components -> KeplerGl -> Mount -> Load custom map style task', t => {
// mount with empty store
const store = mockStore(initialState);
// mount without id or a kepler.gl state
- let wrapper;
const customStyle1 = {
id: 'smoothie',
@@ -359,7 +344,7 @@ test('Components -> KeplerGl -> Mount -> Load custom map style task', t => {
]
};
t.doesNotThrow(() => {
- wrapper = mount(
+ mount(
<Provider store={store}>
<KeplerGl
id="map"
@@ -421,6 +406,7 @@ test('Components -> KeplerGl -> Mount -> Load custom map style task', t => {
);
// Do not remove this. Necessary for testing flow
+ // eslint-disable-next-line no-unused-vars
const resultState2 = coreReducer(resultState1, actions[1]);
const [task1, ...rest] = drainTasksForTesting();
t.equal(rest.length, 0, 'should dispatch 1 tasks');
@@ -455,11 +441,7 @@ test('Components -> KeplerGl -> Mount -> Load custom map style task', t => {
]
};
- t.deepEqual(
- task1.payload,
- expectedTask.payload,
- 'should create task to load map styles'
- );
+ t.deepEqual(task1.payload, expectedTask.payload, 'should create task to load map styles');
t.end();
});
diff --git a/test/browser/components/map-container-test.js b/test/browser/components/map-container-test.js
index 5fcb33b6e..9783deb9a 100644
--- a/test/browser/components/map-container-test.js
+++ b/test/browser/components/map-container-test.js
@@ -77,7 +77,7 @@ test('MapContainerFactory - display all options', t => {
}}
mapboxApiAccessToken=""
editor={{
- features:[]
+ features: []
}}
onMapStyleLoaded={onMapStyleLoaded}
mousePos={{
@@ -88,41 +88,21 @@ test('MapContainerFactory - display all options', t => {
/>
);
- t.equal(
- $.find('MapControl').length,
- 1,
- 'Should display 1 MapControl'
- );
+ t.equal($.find('MapControl').length, 1, 'Should display 1 MapControl');
- t.equal(
- $.find('InteractiveMap').length,
- 1,
- 'Should display 1 InteractiveMap'
- );
+ t.equal($.find('InteractiveMap').length, 1, 'Should display 1 InteractiveMap');
// Editor
- t.equal(
- $.find('StaticMap').length,
- 1,
- 'Should display 1 DeckGl'
- );
+ t.equal($.find('StaticMap').length, 1, 'Should display 1 DeckGl');
const instance = $.instance();
instance._onMapboxStyleUpdate();
- t.equal(
- onMapStyleLoaded.called,
- true,
- 'Should be calling onMapStyleLoaded'
- );
+ t.equal(onMapStyleLoaded.called, true, 'Should be calling onMapStyleLoaded');
instance._onCloseMapPopover();
- t.equal(
- onLayerClick.called,
- true,
- 'Should be calling onLayerClick'
- );
+ t.equal(onLayerClick.called, true, 'Should be calling onLayerClick');
t.end();
});
diff --git a/test/browser/components/map/map-control-test.js b/test/browser/components/map/map-control-test.js
index 69d0556cf..18c534c02 100644
--- a/test/browser/components/map/map-control-test.js
+++ b/test/browser/components/map/map-control-test.js
@@ -25,7 +25,6 @@ import test from 'tape';
import MapControlFactory from 'components/map/map-control';
test('MapControlFactory - display all options', t => {
-
const MapControl = MapControlFactory();
const onToggleSplitMap = sinon.spy();
const onTogglePerspective = sinon.spy();
@@ -53,11 +52,7 @@ test('MapControlFactory - display all options', t => {
/>
);
- t.equal(
- $.find('ActionPanel').length,
- 4,
- 'Should show 4 action panels'
- );
+ t.equal($.find('ActionPanel').length, 4, 'Should show 4 action panels');
t.end();
});
diff --git a/test/browser/components/map/map-legend-test.js b/test/browser/components/map/map-legend-test.js
index 28d3fd500..a002c430e 100644
--- a/test/browser/components/map/map-legend-test.js
+++ b/test/browser/components/map/map-legend-test.js
@@ -74,7 +74,10 @@ test('Components -> MapLegend.render -> with layers', t => {
function testGeojsonLegend(t, geojsonLegend) {
t.equal(
- geojsonLegend.find('.legend--layer_name').at(0).text(),
+ geojsonLegend
+ .find('.legend--layer_name')
+ .at(0)
+ .text(),
geojsonLayer.config.label,
'geojson layer legend should render label'
);
@@ -104,7 +107,10 @@ function testGeojsonLegend(t, geojsonLegend) {
'geojson fill color should render SingleColorLegend'
);
t.deepEqual(
- fillColorLegend.find(SingleColorLegend).at(0).props().color,
+ fillColorLegend
+ .find(SingleColorLegend)
+ .at(0)
+ .props().color,
geojsonLayer.config.color,
'geojson color legend should be correct color'
);
@@ -122,7 +128,10 @@ function testGeojsonLegend(t, geojsonLegend) {
'geojson stroke color should render SingleColorLegend'
);
t.deepEqual(
- strokeColorLegend.find(SingleColorLegend).at(0).props().color,
+ strokeColorLegend
+ .find(SingleColorLegend)
+ .at(0)
+ .props().color,
geojsonLayer.config.visConfig.strokeColor,
'geojson color legend should be correct color'
);
@@ -133,7 +142,10 @@ function testPointLayerLegend(t, pointLegend) {
// color by: gps_data.types
// point layer has 2 color channels, only fill is enabled
t.equal(
- pointLegend.find('.legend--layer_name').at(0).text(),
+ pointLegend
+ .find('.legend--layer_name')
+ .at(0)
+ .text(),
pointLayer.config.label,
'point layer legend should render point label'
);
@@ -176,7 +188,10 @@ function testPointLayerLegend(t, pointLegend) {
function testHexagonLayerLegend(t, hexagonLegend) {
t.equal(
- hexagonLegend.find('.legend--layer_name').at(0).text(),
+ hexagonLegend
+ .find('.legend--layer_name')
+ .at(0)
+ .text(),
hexagonLayer.config.label,
'hexagon layer legend should render label'
);
diff --git a/test/browser/components/modals/data-table-modal-test.js b/test/browser/components/modals/data-table-modal-test.js
index b92370b45..f3213e6a2 100644
--- a/test/browser/components/modals/data-table-modal-test.js
+++ b/test/browser/components/modals/data-table-modal-test.js
@@ -26,15 +26,9 @@ import DataTableModalFactory, {
DatasetTabs,
DatasetModalTab
} from 'components/modals/data-table-modal';
-import DataGridFactory, {
- FieldHeaderFactory,
- CellFactory
-} from 'components/common/datagrid';
+import DataGridFactory, {FieldHeaderFactory, CellFactory} from 'components/common/datagrid';
import {testFields, testAllData} from 'test/fixtures/test-csv-data';
-import {
- geoStyleFields,
- geoStyleRows
-} from 'test/fixtures/geojson';
+import {geoStyleFields, geoStyleRows} from 'test/fixtures/geojson';
const FieldHeader = FieldHeaderFactory();
const Cell = CellFactory();
@@ -71,17 +65,9 @@ test('Components -> DataTableModal.render: csv 1', t => {
// console.log(wrapper.debug());
- t.equal(
- wrapper.find(DataTableModal).length,
- 1,
- 'should render DataTableModal data'
- );
+ t.equal(wrapper.find(DataTableModal).length, 1, 'should render DataTableModal data');
t.equal(wrapper.find(DatasetTabs).length, 1, 'should render DatasetTabs');
- t.equal(
- wrapper.find(DatasetModalTab).length,
- 1,
- 'should render 1 dataset-modal-catalog'
- );
+ t.equal(wrapper.find(DatasetModalTab).length, 1, 'should render 1 dataset-modal-catalog');
t.equal(
wrapper.find('Header').length,
testFields.length,
@@ -137,11 +123,7 @@ test('Components -> DataTableModal.render: csv 1', t => {
.at(c)
.find('span')
.text();
- t.equal(
- cellText,
- expectedRow[c],
- `should render cell ${expectedRow[c]} correctly`
- );
+ t.equal(cellText, expectedRow[c], `should render cell ${expectedRow[c]} correctly`);
}
});
@@ -166,17 +148,9 @@ test('Components -> DataTableModal.render: csv 2', t => {
/>
);
- t.equal(
- wrapper.find(DataTableModal).length,
- 1,
- 'should render DataTableModal data'
- );
+ t.equal(wrapper.find(DataTableModal).length, 1, 'should render DataTableModal data');
t.equal(wrapper.find(DatasetTabs).length, 1, 'should render DatasetTabs');
- t.equal(
- wrapper.find(DatasetModalTab).length,
- 1,
- 'should render 1 dataset-modal-catalog'
- );
+ t.equal(wrapper.find(DatasetModalTab).length, 1, 'should render 1 dataset-modal-catalog');
t.equal(
wrapper.find('Header').length,
geoStyleFields.length,
@@ -226,11 +200,7 @@ test('Components -> DataTableModal.render: csv 2', t => {
.at(c)
.find('span')
.text();
- t.equal(
- cellText,
- expectedRow[c],
- `should render cell ${expectedRow[c]} correctly`
- );
+ t.equal(cellText, expectedRow[c], `should render cell ${expectedRow[c]} correctly`);
}
});
diff --git a/test/browser/components/modals/save-map-modal-test.js b/test/browser/components/modals/save-map-modal-test.js
index fbf0f63e1..28ad8fc8d 100644
--- a/test/browser/components/modals/save-map-modal-test.js
+++ b/test/browser/components/modals/save-map-modal-test.js
@@ -35,17 +35,11 @@ test('Components -> SaveMapModal.mount', t => {
// mount
t.doesNotThrow(() => {
mountWithTheme(
- <SaveMapModal
- onUpdateSetting={onUpdateSetting}
- onSetCloudProvider={onSetCloudProvider}
- />
+ <SaveMapModal onUpdateSetting={onUpdateSetting} onSetCloudProvider={onSetCloudProvider} />
);
}, 'Show not fail without props');
t.ok(onUpdateSetting.calledOnce, 'should call onUpdateSetting when mount');
- t.ok(
- onSetCloudProvider.notCalled,
- 'should not call onSetCloudProvider when mount'
- );
+ t.ok(onSetCloudProvider.notCalled, 'should not call onSetCloudProvider when mount');
t.end();
});
@@ -67,10 +61,7 @@ test('Components -> SaveMapModal.mount with providers', t => {
/>
);
}, 'Show not fail mount props');
- t.ok(
- onSetCloudProvider.calledWithExactly('taro'),
- 'should set default provider when mount'
- );
+ t.ok(onSetCloudProvider.calledWithExactly('taro'), 'should set default provider when mount');
const wrapper = mountWithTheme(
<SaveMapModal
@@ -80,10 +71,7 @@ test('Components -> SaveMapModal.mount with providers', t => {
currentProvider="hello"
/>
);
- t.ok(
- onSetCloudProvider.calledOnce,
- 'should not set default provider if it is already set'
- );
+ t.ok(onSetCloudProvider.calledOnce, 'should not set default provider if it is already set');
t.ok(wrapper.find(CloudTile).length === 1, 'should render 1 cloud provider');
t.ok(wrapper.find(ImagePreview).length === 1, 'should render 1 ImagePreview');
@@ -109,10 +97,7 @@ test('Components -> SaveMapModal on change input', t => {
wrapper.find('textarea#map-description').simulate('change', eventObj);
- t.ok(
- onSetMapInfo.calledWithExactly({description: 'taro'}),
- 'should set map description'
- );
+ t.ok(onSetMapInfo.calledWithExactly({description: 'taro'}), 'should set map description');
t.end();
});
@@ -140,20 +125,27 @@ test('Components -> SaveMapModal on click provider', t => {
wrapper = mountWithTheme(
<SaveMapModal
cloudProviders={[mockProvider, mockProvider2]}
- currentProvider='taro'
+ currentProvider="taro"
onUpdateSetting={() => {}}
- onSetCloudProvider={onSetCloudProvider} />
+ onSetCloudProvider={onSetCloudProvider}
+ />
);
}, 'Show not fail mount props');
t.equal(wrapper.find('.provider-tile__wrapper').length, 2, 'should render 1 provider tile');
// click taro to select
- wrapper.find('.provider-tile__wrapper').at(0).simulate('click');
+ wrapper
+ .find('.provider-tile__wrapper')
+ .at(0)
+ .simulate('click');
t.ok(onSetCloudProvider.calledWithExactly('taro'), 'should call onSetCloudProvider with taro');
// click blue to login
- wrapper.find('.provider-tile__wrapper').at(1).simulate('click');
+ wrapper
+ .find('.provider-tile__wrapper')
+ .at(1)
+ .simulate('click');
t.ok(login.calledOnce, 'should call login');
// call onSuccess after login to set current provider
@@ -172,4 +164,3 @@ test('Components -> SaveMapModal on click provider', t => {
t.end();
});
-
diff --git a/test/browser/components/modals/share-map-modal-test.js b/test/browser/components/modals/share-map-modal-test.js
index c986647f8..b7a0a4d7e 100644
--- a/test/browser/components/modals/share-map-modal-test.js
+++ b/test/browser/components/modals/share-map-modal-test.js
@@ -22,9 +22,7 @@ import React from 'react';
import test from 'tape';
import {mountWithTheme} from 'test/helpers/component-utils';
import sinon from 'sinon';
-import ShareMapUrlModalFactory, {
- SharingUrl
-} from 'components/modals/share-map-modal';
+import ShareMapUrlModalFactory, {SharingUrl} from 'components/modals/share-map-modal';
import CloudTile from 'components/modals/cloud-tile';
import StatusPanel from 'components/modals/status-panel';
@@ -35,14 +33,9 @@ test('Components -> ShareMapUrlModal.mount', t => {
// mount
t.doesNotThrow(() => {
- mountWithTheme(
- <ShareMapUrlModal onSetCloudProvider={onSetCloudProvider} />
- );
+ mountWithTheme(<ShareMapUrlModal onSetCloudProvider={onSetCloudProvider} />);
}, 'Show not fail without props');
- t.ok(
- onSetCloudProvider.notCalled,
- 'should not call onSetCloudProvider when mount'
- );
+ t.ok(onSetCloudProvider.notCalled, 'should not call onSetCloudProvider when mount');
t.end();
});
@@ -57,16 +50,10 @@ test('Components -> ShareMapUrlModal.mount with providers', t => {
// mount
t.doesNotThrow(() => {
mountWithTheme(
- <ShareMapUrlModal
- onSetCloudProvider={onSetCloudProvider}
- cloudProviders={[mockProvider]}
- />
+ <ShareMapUrlModal onSetCloudProvider={onSetCloudProvider} cloudProviders={[mockProvider]} />
);
}, 'Show not fail mount props');
- t.ok(
- onSetCloudProvider.calledWithExactly('taro'),
- 'should set default provider when mount'
- );
+ t.ok(onSetCloudProvider.calledWithExactly('taro'), 'should set default provider when mount');
const wrapper = mountWithTheme(
<ShareMapUrlModal
@@ -75,10 +62,7 @@ test('Components -> ShareMapUrlModal.mount with providers', t => {
currentProvider="hello"
/>
);
- t.ok(
- onSetCloudProvider.calledOnce,
- 'should not set default provider if it is already set'
- );
+ t.ok(onSetCloudProvider.calledOnce, 'should not set default provider if it is already set');
t.ok(wrapper.find(CloudTile).length === 1, 'should render 1 cloud provider');
t.ok(wrapper.find(StatusPanel).length === 0, 'should not render StatusPanel');
@@ -95,18 +79,11 @@ test('Components -> ShareMapUrlModal.mount with isLoading', t => {
let wrapper;
t.doesNotThrow(() => {
wrapper = mountWithTheme(
- <ShareMapUrlModal
- isLoading
- onSetCloudProvider={() => {}}
- cloudProviders={[mockProvider]}
- />
+ <ShareMapUrlModal isLoading onSetCloudProvider={() => {}} cloudProviders={[mockProvider]} />
);
}, 'Show not fail mount with isLoading');
- t.ok(
- wrapper.find(StatusPanel).length === 1,
- 'should render StatusPanel when loading'
- );
+ t.ok(wrapper.find(StatusPanel).length === 1, 'should render StatusPanel when loading');
wrapper = mountWithTheme(
<ShareMapUrlModal
@@ -115,15 +92,8 @@ test('Components -> ShareMapUrlModal.mount with isLoading', t => {
cloudProviders={[mockProvider]}
/>
);
- t.ok(
- wrapper.find(StatusPanel).length === 1,
- 'should render StatusPanel when error'
- );
- t.equal(
- wrapper.find('.notification-item--message').length,
- 1,
- 'should render 1 message'
- );
+ t.ok(wrapper.find(StatusPanel).length === 1, 'should render StatusPanel when error');
+ t.equal(wrapper.find('.notification-item--message').length, 1, 'should render 1 message');
t.equal(
wrapper
.find('.notification-item--message')
@@ -156,10 +126,7 @@ test('Components -> ShareMapUrlModal.mount with SharingUrl', t => {
);
}, 'Show not fail mount with successInfo');
- t.ok(
- wrapper.find(SharingUrl).length === 1,
- 'should render SharingUrl when loading'
- );
+ t.ok(wrapper.find(SharingUrl).length === 1, 'should render SharingUrl when loading');
t.equal(
wrapper
diff --git a/test/browser/components/notifications/notification-item-test.js b/test/browser/components/notifications/notification-item-test.js
index ae8433a4a..7eaa4a5e9 100644
--- a/test/browser/components/notifications/notification-item-test.js
+++ b/test/browser/components/notifications/notification-item-test.js
@@ -29,12 +29,7 @@ const NotificationItem = NotificationItemFactory();
test('Notification item -> display SUCCESS notification', t => {
const notification = createNotification({message: 'success', type: 'success'});
- const $ = shallow(
- <NotificationItem
- theme={theme}
- notification={notification}
- />
- );
+ const $ = shallow(<NotificationItem theme={theme} notification={notification} />);
// validate the icon
t.equal($.find('Checkmark').length, 1, 'Should display info icon');
@@ -49,12 +44,7 @@ test('Notification item -> display SUCCESS notification', t => {
test('Notification item -> display ERROR notification', t => {
const notification = createNotification({message: 'error', type: 'error'});
- const $ = shallow(
- <NotificationItem
- notification={notification}
- theme={theme}
- />
- );
+ const $ = shallow(<NotificationItem notification={notification} theme={theme} />);
// validate the icon
t.equal($.find('Warning').length, 1, 'Should display warning icon');
diff --git a/test/browser/components/notifications/notification-panel-test.js b/test/browser/components/notifications/notification-panel-test.js
index fb93a8c26..d9a6e1d67 100644
--- a/test/browser/components/notifications/notification-panel-test.js
+++ b/test/browser/components/notifications/notification-panel-test.js
@@ -52,4 +52,3 @@ test('Notification Panel - Show notifications', t => {
t.end();
});
-
diff --git a/test/browser/components/side-panel/color-selector-test.js b/test/browser/components/side-panel/color-selector-test.js
index f2d68bbc8..2efebaf06 100644
--- a/test/browser/components/side-panel/color-selector-test.js
+++ b/test/browser/components/side-panel/color-selector-test.js
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-/* eslint-disable max-statements */import React from 'react';
+/* eslint-disable max-statements */ import React from 'react';
import test from 'tape';
import {mount} from 'enzyme';
import sinon from 'sinon';
@@ -44,16 +44,11 @@ import ColorRangeSelector, {
import ColorPalette from 'components/side-panel/layer-panel/color-palette';
import CustomPalette from 'components/side-panel/layer-panel/custom-palette';
import CustomPicker from 'components/side-panel/layer-panel/custom-picker';
-
-import ItemSelector from 'components/common/item-selector/item-selector';
-import {Button, InlineInput} from 'components/common/styled-components';
+import {Button} from 'components/common/styled-components';
import {COLOR_RANGES} from 'constants/color-ranges';
-import {
- StateWFilesFiltersLayerColor,
- StateWTrips
-} from 'test/helpers/mock-state';
+import {StateWFilesFiltersLayerColor, StateWTrips} from 'test/helpers/mock-state';
import {mountWithTheme} from 'test/helpers/component-utils';
import {hexToRgb} from 'utils/color-utils';
@@ -88,9 +83,7 @@ test('Components -> LayerColorSelector.render -> render layer color', t => {
const layerConfiguratorProps = getLayerConfiguratorProps(mockProps);
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <LayerColorSelector {...layerConfiguratorProps} />
- );
+ wrapper = mountWithTheme(<LayerColorSelector {...layerConfiguratorProps} />);
}, 'Should not fail with layers');
const CSInstance = wrapper.find(ColorSelector);
@@ -103,11 +96,7 @@ test('Components -> LayerColorSelector.render -> render layer color', t => {
setColor: () => {}
}
];
- t.equal(
- cSProps.colorSets.length,
- expectedColorSets.length,
- 'should pass correct colorSets'
- );
+ t.equal(cSProps.colorSets.length, expectedColorSets.length, 'should pass correct colorSets');
t.deepEqual(
Object.keys(cSProps.colorSets[0]),
Object.keys(expectedColorSets[0]),
@@ -161,9 +150,7 @@ test('Components -> LayerColorSelector.render -> render single color click', t =
const layerConfiguratorProps = getLayerConfiguratorProps(mockProps);
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <LayerColorSelector {...layerConfiguratorProps} />
- );
+ wrapper = mountWithTheme(<LayerColorSelector {...layerConfiguratorProps} />);
}, 'Should not fail render color select');
const CSInstance = wrapper.find(ColorSelector);
@@ -173,10 +160,7 @@ test('Components -> LayerColorSelector.render -> render single color click', t =
const scp = wrapper.find(SingleColorPalette);
t.equal(scp.length, 1, 'should render 1 SingleColorPalette');
- t.ok(
- wrapper.find('.single-color-palette__block'),
- 'should render color blocks'
- );
+ t.ok(wrapper.find('.single-color-palette__block'), 'should render color blocks');
// click color block
wrapper
@@ -238,11 +222,7 @@ test('Components -> ArcLayerColorSelector.render -> render single color', t => {
label: 'Target'
}
];
- t.equal(
- cSProps.colorSets.length,
- expectedColorSets.length,
- 'should pass correct colorSets'
- );
+ t.equal(cSProps.colorSets.length, expectedColorSets.length, 'should pass correct colorSets');
t.deepEqual(
Object.keys(cSProps.colorSets[0]),
Object.keys(expectedColorSets[0]),
@@ -262,18 +242,12 @@ test('Components -> ArcLayerColorSelector.render -> render single color', t => {
t.equal(csInput.length, 2, 'should render 2 ColorSelectorInput');
csInput.at(1).simulate('mousedown');
- t.ok(
- updateLayerColorUI.calledOnce,
- 'should call updateLayerColorUI when mousedown 2nd block'
- );
+ t.ok(updateLayerColorUI.calledOnce, 'should call updateLayerColorUI when mousedown 2nd block');
t.ok(
updateLayerVisConfig.notCalled,
'should not call updateLayerColorUI when mousedown 2nd block'
);
- t.ok(
- updateLayerConfig.notCalled,
- 'should not call updateLayerConfig when mousedown 2nd block'
- );
+ t.ok(updateLayerConfig.notCalled, 'should not call updateLayerConfig when mousedown 2nd block');
// should open dropdown
t.ok(updateLayerColorUI.calledWith('color', {showDropdown: 1}));
@@ -321,10 +295,7 @@ test('Components -> ArcLayerColorSelector.render -> render single color click',
const scp = wrapper.find(SingleColorPalette);
t.equal(scp.length, 1, 'should render 1 SingleColorPalette');
- t.ok(
- wrapper.find('.single-color-palette__block'),
- 'should render color blocks'
- );
+ t.ok(wrapper.find('.single-color-palette__block'), 'should render color blocks');
// click color block
wrapper
@@ -358,9 +329,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector', t => {
let wrapper;
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <LayerColorRangeSelector {...visConfiguratorProps} />
- );
+ wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);
}, 'Should not fail render color range select');
const CPInstance = wrapper.find(ColorPalette);
t.equal(CPInstance.length, 1, 'should render 1 ColorPalette');
@@ -382,18 +351,12 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector', t => {
t.equal(csInput.length, 1, 'should render 2 ColorSelectorInput');
csInput.at(0).simulate('mousedown');
- t.ok(
- updateLayerColorUI.calledOnce,
- 'should call updateLayerColorUI when mousedown 2nd block'
- );
+ t.ok(updateLayerColorUI.calledOnce, 'should call updateLayerColorUI when mousedown 2nd block');
t.ok(
updateLayerVisConfig.notCalled,
'should not call updateLayerColorUI when mousedown 2nd block'
);
- t.ok(
- updateLayerConfig.notCalled,
- 'should not call updateLayerConfig when mousedown 2nd block'
- );
+ t.ok(updateLayerConfig.notCalled, 'should not call updateLayerConfig when mousedown 2nd block');
// should open dropdown
t.ok(updateLayerColorUI.calledWith('colorRange', {showDropdown: 0}));
@@ -425,17 +388,11 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
let wrapper;
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <LayerColorRangeSelector {...visConfiguratorProps} />
- );
+ wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);
}, 'Should not fail render color range select');
// open color dropdown
- t.equal(
- wrapper.find('.color-range-selector').length,
- 1,
- 'should render 1 color-range-selector'
- );
+ t.equal(wrapper.find('.color-range-selector').length, 1, 'should render 1 color-range-selector');
const crs = wrapper.find(ColorRangeSelector);
t.equal(crs.length, 1, 'should render 1 ColorRangeSelector');
@@ -446,8 +403,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
const cpg = crs.find(ColorPaletteGroup);
t.equal(cpg.length, 1, 'should render 1 ColorPaletteGroup');
- const expectedGroups =
- COLOR_RANGES.filter(cr => cr.colors.length === 6).length + 1;
+ const expectedGroups = COLOR_RANGES.filter(cr => cr.colors.length === 6).length + 1;
t.equal(
wrapper.find(ColorPalette).length,
@@ -455,11 +411,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
`should render ${expectedGroups} ColorPalette`
);
const typeSelect = crs.find(PaletteConfig).at(0);
- t.equal(
- typeSelect.find('.side-panel-panel__label').text(),
- 'type',
- 'should render type'
- );
+ t.equal(typeSelect.find('.side-panel-panel__label').text(), 'type', 'should render type');
// click on type select
t.equal(
@@ -592,17 +544,11 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
const visConfiguratorProps = getVisConfiguratorProps(mockProps);
let wrapper;
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <LayerColorRangeSelector {...visConfiguratorProps} />
- );
+ wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);
}, 'Should not fail render color range select');
// open color dropdown
- t.equal(
- wrapper.find('.color-range-selector').length,
- 1,
- 'should render 1 color-range-selector'
- );
+ t.equal(wrapper.find('.color-range-selector').length, 1, 'should render 1 color-range-selector');
const crs = wrapper.find(ColorRangeSelector);
t.equal(crs.length, 1, 'should render 1 ColorRangeSelector');
@@ -645,9 +591,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
const visConfiguratorProps = getVisConfiguratorProps(mockProps);
let wrapper;
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <LayerColorRangeSelector {...visConfiguratorProps} />
- );
+ wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);
}, 'Should not fail render color range select');
// current colorRange
// { name: 'Ice And Fire 8',
@@ -675,21 +619,25 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
.simulate('click');
t.deepEqual(
- updateLayerColorUI.args[0], ['colorRange', {
- customPalette: {
- colors: [
- '#7F1941',
- '#D50255',
- '#FEAD54',
- '#FEEDB1',
- '#E8FEB5',
- '#49E3CE',
- '#0198BD',
- '#007A99',
- '#007A99'
- ]
+ updateLayerColorUI.args[0],
+ [
+ 'colorRange',
+ {
+ customPalette: {
+ colors: [
+ '#7F1941',
+ '#D50255',
+ '#FEAD54',
+ '#FEEDB1',
+ '#E8FEB5',
+ '#49E3CE',
+ '#0198BD',
+ '#007A99',
+ '#007A99'
+ ]
+ }
}
- }],
+ ],
'should add color to custom palette when click add step'
);
@@ -699,10 +647,14 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
.simulate('click');
t.deepEqual(
- updateLayerColorUI.args[1], ['colorRange', {
- colorRangeConfig: {custom: false},
- showSketcher: false
- }],
+ updateLayerColorUI.args[1],
+ [
+ 'colorRange',
+ {
+ colorRangeConfig: {custom: false},
+ showSketcher: false
+ }
+ ],
'should set custom: false when cancel'
);
@@ -712,31 +664,38 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
.simulate('click');
t.deepEqual(
- updateLayerColorUI.args[2], ['colorRange', {
- colorRangeConfig: {custom: false},
- showSketcher: false
- }],
+ updateLayerColorUI.args[2],
+ [
+ 'colorRange',
+ {
+ colorRangeConfig: {custom: false},
+ showSketcher: false
+ }
+ ],
'should set custom to false when click apply'
);
t.deepEqual(
- updateLayerVisConfig.args[0], [{
- colorRange: {
- name: 'Custom Palette',
- type: 'custom',
- category: 'Custom',
- colors: [
- '#7F1941',
- '#D50255',
- '#FEAD54',
- '#FEEDB1',
- '#E8FEB5',
- '#49E3CE',
- '#0198BD',
- '#007A99'
- ]
+ updateLayerVisConfig.args[0],
+ [
+ {
+ colorRange: {
+ name: 'Custom Palette',
+ type: 'custom',
+ category: 'Custom',
+ colors: [
+ '#7F1941',
+ '#D50255',
+ '#FEAD54',
+ '#FEEDB1',
+ '#E8FEB5',
+ '#49E3CE',
+ '#0198BD',
+ '#007A99'
+ ]
+ }
}
- }],
+ ],
'should set colorRange to custom'
);
@@ -784,9 +743,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRang
const visConfiguratorProps = getVisConfiguratorProps(mockProps);
let wrapper;
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <LayerColorRangeSelector {...visConfiguratorProps} />
- );
+ wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);
}, 'Should not fail render color range select');
const cp = wrapper.find(CustomPalette);
diff --git a/test/browser/components/side-panel/save-export-dropdown-test.js b/test/browser/components/side-panel/save-export-dropdown-test.js
index 741af55fc..8ad1221bf 100644
--- a/test/browser/components/side-panel/save-export-dropdown-test.js
+++ b/test/browser/components/side-panel/save-export-dropdown-test.js
@@ -29,11 +29,8 @@ import {
import ToolbarItem from 'components/common/toolbar-item';
test('SaveExportDropdown', t => {
-
const PanelHeaderDropdown = PanelHeaderDropdownFactory();
- const SaveExportDropdown = SaveExportDropdownFactory(
- PanelHeaderDropdown
- );
+ const SaveExportDropdown = SaveExportDropdownFactory(PanelHeaderDropdown);
const onExportImage = sinon.spy();
const onExportData = sinon.spy();
@@ -53,45 +50,32 @@ test('SaveExportDropdown', t => {
onClose={onClose}
/>
);
- t.equal(
- wrapper.find(PanelHeaderDropdown).length,
- 1,
- 'We should display 1 PanelHeaderDropdown'
- );
- t.equal(
- wrapper.find(ToolbarItem).length,
- 4,
- 'We should display 4 ToolbarItems'
- );
+ t.equal(wrapper.find(PanelHeaderDropdown).length, 1, 'We should display 1 PanelHeaderDropdown');
+ t.equal(wrapper.find(ToolbarItem).length, 4, 'We should display 4 ToolbarItems');
- wrapper.find('.toolbar-item').at(0).simulate('click');
- t.equal(
- onExportImage.called,
- true,
- 'Should have called export image callback'
- );
+ wrapper
+ .find('.toolbar-item')
+ .at(0)
+ .simulate('click');
+ t.equal(onExportImage.called, true, 'Should have called export image callback');
- wrapper.find('.toolbar-item').at(1).simulate('click');
- t.equal(
- onExportData.called,
- true,
- 'Should have called export data callback'
- );
+ wrapper
+ .find('.toolbar-item')
+ .at(1)
+ .simulate('click');
+ t.equal(onExportData.called, true, 'Should have called export data callback');
- wrapper.find('.toolbar-item').at(2).simulate('click');
- t.equal(
- onExportMap.called,
- true,
- 'Should have called export map callback'
- );
+ wrapper
+ .find('.toolbar-item')
+ .at(2)
+ .simulate('click');
+ t.equal(onExportMap.called, true, 'Should have called export map callback');
- wrapper.find('.toolbar-item').at(3).simulate('click');
- t.equal(
- onSaveMap.called,
- true,
- 'Should have called save map callback'
- );
+ wrapper
+ .find('.toolbar-item')
+ .at(3)
+ .simulate('click');
+ t.equal(onSaveMap.called, true, 'Should have called save map callback');
t.end();
});
-
diff --git a/test/browser/components/side-panel/side-panel-test.js b/test/browser/components/side-panel/side-panel-test.js
index 534d40269..5b66cd0cf 100644
--- a/test/browser/components/side-panel/side-panel-test.js
+++ b/test/browser/components/side-panel/side-panel-test.js
@@ -20,7 +20,6 @@
import React from 'react';
import test from 'tape';
-import {mount} from 'enzyme';
import sinon from 'sinon';
import SidePanelFactory from 'components/side-panel';
import SidebarFactory from 'components/side-panel/side-bar';
@@ -35,10 +34,8 @@ import {SaveExportDropdownFactory} from 'components/side-panel/panel-header';
import ToolbarItem from 'components/common/toolbar-item';
import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStateActions from 'actions/map-state-actions';
import * as MapStyleActions from 'actions/map-style-actions';
import * as UIStateActions from 'actions/ui-state-actions';
-import * as ProviderActions from 'actions/provider-actions';
import {appInjector} from 'components/container';
import {mountWithTheme} from 'test/helpers/component-utils';
@@ -52,24 +49,13 @@ const FilterManager = appInjector.get(FilterManagerFactory);
const InteractionManager = appInjector.get(InteractionManagerFactory);
const MapManager = appInjector.get(MapManagerFactory);
const PanelToggle = appInjector.get(PanelToggleFactory);
-const CustomPanels = appInjector.get(CustomPanelsFactory);
const SaveExportDropdown = appInjector.get(SaveExportDropdownFactory);
// mock state
import {InitialState} from 'test/helpers/mock-state';
// Constants
-import {
- ADD_DATA_ID,
- ADD_MAP_STYLE_ID,
- DATA_TABLE_ID,
- EXPORT_IMAGE_ID,
- EXPORT_DATA_ID,
- EXPORT_MAP_ID,
- SAVE_MAP_ID,
- SHARE_MAP_ID,
- SIDEBAR_PANELS
-} from 'constants/default-settings';
+import {EXPORT_IMAGE_ID, EXPORT_DATA_ID, EXPORT_MAP_ID} from 'constants/default-settings';
// default props from initial state
const defaultProps = {
@@ -113,41 +99,29 @@ test('Components -> SidePanel -> toggle panel', t => {
let wrapper;
// mount
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <SidePanel {...defaultProps} uiStateActions={uiStateActions} />
- );
+ wrapper = mountWithTheme(<SidePanel {...defaultProps} uiStateActions={uiStateActions} />);
}, 'SidePanel should not fail');
t.ok(wrapper.find(PanelToggle).length === 1, 'should render PanelToggle');
- t.equal(
- wrapper.find('.side-panel__tab').length,
- 4,
- 'should render 4 panel tabs'
- );
+ t.equal(wrapper.find('.side-panel__tab').length, 4, 'should render 4 panel tabs');
const layerTab = wrapper.find('.side-panel__tab').at(0);
// click layer tab
layerTab.simulate('click');
- t.ok(
- toggleSidePanel.calledWith('layer'),
- 'should call toggleSidePanel with layer'
- );
+ t.ok(toggleSidePanel.calledWith('layer'), 'should call toggleSidePanel with layer');
t.end();
});
test('Components -> SidePanel -> render panel', t => {
-
let wrapper;
let uiState = {
...defaultProps.uiState,
activeSidePanel: 'layer'
- }
+ };
// mount LayerManager
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <SidePanel {...defaultProps} uiState={uiState} />
- );
+ wrapper = mountWithTheme(<SidePanel {...defaultProps} uiState={uiState} />);
}, 'SidePanel should not fail');
t.ok(wrapper.find(LayerManager).length === 1, 'should render LayerManager');
@@ -156,11 +130,9 @@ test('Components -> SidePanel -> render panel', t => {
uiState = {
...defaultProps.uiState,
activeSidePanel: 'filter'
- }
+ };
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <SidePanel {...defaultProps} uiState={uiState} />
- );
+ wrapper = mountWithTheme(<SidePanel {...defaultProps} uiState={uiState} />);
}, 'SidePanel should not fail');
t.ok(wrapper.find(FilterManager).length === 1, 'should render FilterManager');
@@ -168,23 +140,19 @@ test('Components -> SidePanel -> render panel', t => {
uiState = {
...defaultProps.uiState,
activeSidePanel: 'interaction'
- }
+ };
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <SidePanel {...defaultProps} uiState={uiState} />
- );
+ wrapper = mountWithTheme(<SidePanel {...defaultProps} uiState={uiState} />);
}, 'SidePanel should not fail');
t.ok(wrapper.find(InteractionManager).length === 1, 'should render InteractionManager');
- // mount MapManager
- uiState = {
+ // mount MapManager
+ uiState = {
...defaultProps.uiState,
activeSidePanel: 'map'
- }
+ };
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <SidePanel {...defaultProps} uiState={uiState} />
- );
+ wrapper = mountWithTheme(<SidePanel {...defaultProps} uiState={uiState} />);
}, 'SidePanel should not fail');
t.ok(wrapper.find(MapManager).length === 1, 'should render MapManager');
@@ -192,8 +160,8 @@ test('Components -> SidePanel -> render panel', t => {
});
test('Components -> SidePanel -> render custom panel', t => {
- const RocketIcon = () => <div id="rocket-icon"/>;
- const ChartIcon = () => <div id="chart-icon"/>
+ const RocketIcon = () => <div id="rocket-icon" />;
+ const ChartIcon = () => <div id="chart-icon" />;
const MyPanels = props => {
if (props.activeSidePanel === 'rocket') {
@@ -235,16 +203,10 @@ test('Components -> SidePanel -> render custom panel', t => {
// mount CustomSidePanel
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <CustomSidePanel {...defaultProps} />
- );
+ wrapper = mountWithTheme(<CustomSidePanel {...defaultProps} />);
}, 'SidePanel should not fail');
- t.equal(
- wrapper.find('.side-panel__tab').length,
- 6,
- 'should render 6 panel tabs'
- );
+ t.equal(wrapper.find('.side-panel__tab').length, 6, 'should render 6 panel tabs');
t.equal(wrapper.find(RocketIcon).length, 1, 'should render RocketIcon');
t.equal(wrapper.find(ChartIcon).length, 1, 'should render RocketIcon');
@@ -252,15 +214,9 @@ test('Components -> SidePanel -> render custom panel', t => {
// mount CustomSidePanel with 1 of the custom panel
const uiState = {...defaultProps.uiState, activeSidePanel: 'rocket'};
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <CustomSidePanel {...defaultProps} uiState={uiState}/>
- );
+ wrapper = mountWithTheme(<CustomSidePanel {...defaultProps} uiState={uiState} />);
}, 'SidePanel should not fail when mount with custom side panel activated');
- t.equal(
- wrapper.find(MyPanels).length,
- 1,
- 'should render MyPanels'
- );
+ t.equal(wrapper.find(MyPanels).length, 1, 'should render MyPanels');
t.end();
});
@@ -274,9 +230,7 @@ test('Components -> SidePanel -> PanelHeader', t => {
let wrapper;
// mount
t.doesNotThrow(() => {
- wrapper = mountWithTheme(
- <SidePanel {...defaultProps} uiStateActions={uiStateActions} />
- );
+ wrapper = mountWithTheme(<SidePanel {...defaultProps} uiStateActions={uiStateActions} />);
}, 'SidePanel should not fail');
t.ok(wrapper.find(PanelHeader).length === 1, 'should render PanelHeader');
@@ -306,10 +260,7 @@ test('Components -> SidePanel -> PanelHeader', t => {
.at(0)
.simulate('click');
- t.ok(
- showExportDropdown.calledWith('save'),
- 'should call toggleSidePanel with share'
- );
+ t.ok(showExportDropdown.calledWith('save'), 'should call toggleSidePanel with share');
// mound with exportDropdown
const uiState = {
@@ -318,11 +269,7 @@ test('Components -> SidePanel -> PanelHeader', t => {
};
t.doesNotThrow(() => {
wrapper = mountWithTheme(
- <SidePanel
- {...defaultProps}
- uiState={uiState}
- uiStateActions={uiStateActions}
- />
+ <SidePanel {...defaultProps} uiState={uiState} uiStateActions={uiStateActions} />
);
}, 'SidePanel should not fail');
@@ -346,18 +293,11 @@ test('Components -> SidePanel -> PanelHeader -> ExportDropDown', t => {
// mount
t.doesNotThrow(() => {
wrapper = mountWithTheme(
- <SidePanel
- {...defaultProps}
- uiState={uiState}
- uiStateActions={uiStateActions}
- />
+ <SidePanel {...defaultProps} uiState={uiState} uiStateActions={uiStateActions} />
);
}, 'SidePanel should not fail');
- t.ok(
- wrapper.find(SaveExportDropdown).length === 1,
- 'should render SaveExportDropdown'
- );
+ t.ok(wrapper.find(SaveExportDropdown).length === 1, 'should render SaveExportDropdown');
t.equal(wrapper.find(ToolbarItem).length, 3, 'should render 3 ToolbarItem');
// export image
@@ -375,10 +315,7 @@ test('Components -> SidePanel -> PanelHeader -> ExportDropDown', t => {
.at(0)
.find('.toolbar-item')
.simulate('click');
- t.ok(
- toggleModal.calledWith(EXPORT_IMAGE_ID),
- 'Should call toggleModal with EXPORT_IMAGE_ID'
- );
+ t.ok(toggleModal.calledWith(EXPORT_IMAGE_ID), 'Should call toggleModal with EXPORT_IMAGE_ID');
// export data
t.equal(
@@ -395,10 +332,7 @@ test('Components -> SidePanel -> PanelHeader -> ExportDropDown', t => {
.at(1)
.find('.toolbar-item')
.simulate('click');
- t.ok(
- toggleModal.calledWith(EXPORT_DATA_ID),
- 'Should call toggleModal with EXPORT_DATA_ID'
- );
+ t.ok(toggleModal.calledWith(EXPORT_DATA_ID), 'Should call toggleModal with EXPORT_DATA_ID');
// export map
t.equal(
@@ -415,10 +349,7 @@ test('Components -> SidePanel -> PanelHeader -> ExportDropDown', t => {
.at(2)
.find('.toolbar-item')
.simulate('click');
- t.ok(
- toggleModal.calledWith(EXPORT_MAP_ID),
- 'Should call toggleModal with EXPORT_MAP_ID'
- );
+ t.ok(toggleModal.calledWith(EXPORT_MAP_ID), 'Should call toggleModal with EXPORT_MAP_ID');
t.end();
});
diff --git a/test/browser/layer-tests/arc-layer-specs.js b/test/browser/layer-tests/arc-layer-specs.js
index 4cf3f328f..04dbe62fb 100644
--- a/test/browser/layer-tests/arc-layer-specs.js
+++ b/test/browser/layer-tests/arc-layer-specs.js
@@ -52,20 +52,11 @@ test('#ArcLayer -> constructor', t => {
label: 'test arc layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'ArcLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'smoothie', 'ArcLayer dataId should be correct');
t.ok(layer.type === 'arc', 'type should be arc');
t.ok(layer.isAggregated === false, 'ArcLayer is not aggregated');
- t.ok(
- layer.config.label === 'test arc layer',
- 'label should be correct'
- );
- t.ok(
- Object.keys(layer.columnPairs).length,
- 'should have columnPairs'
- );
+ t.ok(layer.config.label === 'test arc layer', 'label should be correct');
+ t.ok(Object.keys(layer.columnPairs).length, 'should have columnPairs');
}
}
]
@@ -159,11 +150,7 @@ test('#ArcLayer -> formatLayerData', t => {
);
// layerMeta
- t.deepEqual(
- layer.meta,
- arcLayerMeta,
- 'should format correct arc layer meta'
- );
+ t.deepEqual(layer.meta, arcLayerMeta, 'should format correct arc layer meta');
}
},
{
@@ -209,11 +196,7 @@ test('#ArcLayer -> formatLayerData', t => {
'getSourceColor should be a constant'
);
// getSourceColor
- t.deepEqual(
- layerData.getTargetColor,
- [1, 2, 3],
- 'getTargetColors should be a constant'
- );
+ t.deepEqual(layerData.getTargetColor, [1, 2, 3], 'getTargetColors should be a constant');
}
},
{
@@ -224,7 +207,7 @@ test('#ArcLayer -> formatLayerData', t => {
label: 'trip arcs',
columns,
color: [10, 10, 10],
- // color by types(string)
+ // color by types(string)
colorField: {
type: 'string',
name: 'types'
@@ -289,7 +272,10 @@ test('#ArcLayer -> formatLayerData', t => {
// range ['#010101', '#020202', '#030303']
t.deepEqual(
layerData.data.map(layerData.getSourceColor),
- [[2, 2, 2], [1, 1, 1]],
+ [
+ [2, 2, 2],
+ [1, 1, 1]
+ ],
'getSourceColor should be correct'
);
// getTargetColor
@@ -297,7 +283,10 @@ test('#ArcLayer -> formatLayerData', t => {
// range ['#010101', '#020202', '#030303']
t.deepEqual(
layerData.data.map(layerData.getTargetColor),
- [[2, 2, 2], [1, 1, 1]],
+ [
+ [2, 2, 2],
+ [1, 1, 1]
+ ],
'getTargetColors be correct'
);
// getWidth
@@ -314,7 +303,7 @@ test('#ArcLayer -> formatLayerData', t => {
layerData.data.map(layerData.getFilterValue),
[
[Number.MIN_SAFE_INTEGER, 0, 0, 0],
- [moment.utc(testRows[4][0]).valueOf() - preparedFilterDomain0, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - preparedFilterDomain0, 0, 0, 0]
],
'getFilterValue should return [value, 0, 0, 0]'
);
@@ -356,13 +345,9 @@ test('#ArcLayer -> renderLayer', t => {
opacity: layer.config.visConfig.opacity,
widthScale: layer.config.visConfig.thickness,
filterRange: preparedDataset.gpuFilter.filterRange
- }
+ };
Object.keys(expectedProps).forEach(key => {
- t.equal(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.equal(props[key], expectedProps[key], `should have correct props.${key}`);
});
}
},
@@ -402,13 +387,9 @@ test('#ArcLayer -> renderLayer', t => {
brushingRadius: 2500,
brushingEnabled: true,
brushingTarget: 'source_target'
- }
+ };
Object.keys(expectedProps).forEach(key => {
- t.equal(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.equal(props[key], expectedProps[key], `should have correct props.${key}`);
});
}
}
diff --git a/test/browser/layer-tests/base-layer-sepcs.js b/test/browser/layer-tests/base-layer-sepcs.js
index 4e75801c2..e15dd12bd 100644
--- a/test/browser/layer-tests/base-layer-sepcs.js
+++ b/test/browser/layer-tests/base-layer-sepcs.js
@@ -100,7 +100,12 @@ test('#BaseLayer -> updateLayerDomain', t => {
});
*/
test('#AggregationLayer -> updateLayerDomain', t => {
- const data = [['a', 3], ['b', 4], ['c', 1], ['d', null]];
+ const data = [
+ ['a', 3],
+ ['b', 4],
+ ['c', 1],
+ ['d', null]
+ ];
const mockLayer = new AggregationLayer({dataId: 'test'});
mockLayer.updateLayerConfig({
@@ -115,8 +120,11 @@ test('#AggregationLayer -> updateLayerDomain', t => {
});
const updatedLayer = mockLayer.updateLayerDomain({test: {data, allData: data}});
- t.deepEqual(updatedLayer.config.colorDomain, [0, 1],
- 'should not calculate aggregation layer domain');
+ t.deepEqual(
+ updatedLayer.config.colorDomain,
+ [0, 1],
+ 'should not calculate aggregation layer domain'
+ );
t.end();
});
diff --git a/test/browser/layer-tests/cluster-layer-specs.js b/test/browser/layer-tests/cluster-layer-specs.js
index c376ee6de..6e30e1270 100644
--- a/test/browser/layer-tests/cluster-layer-specs.js
+++ b/test/browser/layer-tests/cluster-layer-specs.js
@@ -51,20 +51,11 @@ test('#ClusterLayer -> constructor', t => {
label: 'test cluster layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'taro',
- 'clusterLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'taro', 'clusterLayer dataId should be correct');
t.ok(layer.type === 'cluster', 'type should be cluster');
t.ok(layer.isAggregated === true, 'clusterLayer is aggregated');
- t.ok(
- layer.config.label === 'test cluster layer',
- 'label should be correct'
- );
- t.ok(
- Object.keys(layer.columnPairs).length,
- 'should have columnPairs'
- );
+ t.ok(layer.config.label === 'test cluster layer', 'label should be correct');
+ t.ok(Object.keys(layer.columnPairs).length, 'should have columnPairs');
}
}
]
@@ -114,11 +105,7 @@ test('#ClusterLayer -> formatLayerData', t => {
Object.keys(expectedLayerData).sort(),
'layerData should have 4 keys'
);
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct grid layerData'
- );
+ t.deepEqual(layerData.data, expectedLayerData.data, 'should format correct grid layerData');
// test getPosition
t.deepEqual(
layerData.getPosition(layerData.data[0]),
@@ -149,11 +136,7 @@ test('#ClusterLayer -> formatLayerData', t => {
'_filterData should filter data correctly'
);
// test layer.meta
- t.deepEqual(
- layer.meta,
- pointLayerMeta,
- 'should format correct grid layer meta'
- );
+ t.deepEqual(layer.meta, pointLayerMeta, 'should format correct grid layer meta');
}
},
{
@@ -295,11 +278,7 @@ test('#ClusterLayer -> renderLayer', t => {
};
Object.keys(expectedProps).forEach(key => {
- t.deepEqual(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.deepEqual(props[key], expectedProps[key], `should have correct props.${key}`);
});
const expectedScatterplotData = [
@@ -356,8 +335,7 @@ test('#ClusterLayer -> renderLayer', t => {
// fillColor
t.deepEqual(
- clusterLayer.state.aggregatorState.dimensions.fillColor.sortedBins
- .sortedBins,
+ clusterLayer.state.aggregatorState.dimensions.fillColor.sortedBins.sortedBins,
expectedColorBins,
'should create correct color bins sortedBins'
);
diff --git a/test/browser/layer-tests/geojson-layer-specs.js b/test/browser/layer-tests/geojson-layer-specs.js
index a845c0bdb..2a951ecae 100644
--- a/test/browser/layer-tests/geojson-layer-specs.js
+++ b/test/browser/layer-tests/geojson-layer-specs.js
@@ -25,10 +25,7 @@ import GeojsonLayer, {
defaultRadius
} from 'layers/geojson-layer/geojson-layer';
-import {
- updatedLayerSimplifiedShape,
- updatedLayerV2
-} from 'test/fixtures/test-csv-data';
+import {updatedLayerV2} from 'test/fixtures/test-csv-data';
import {
dataId,
preparedGeoDataset,
@@ -58,10 +55,7 @@ test('#GeojsonLayer -> constructor', t => {
label: 'test geojson layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'geojsonLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'smoothie', 'geojsonLayer dataId should be correct');
t.ok(layer.type === 'geojson', 'type should be geojson');
t.ok(layer.isAggregated === false, 'geojsonLayer is not aggregated');
}
@@ -100,10 +94,7 @@ test('#GeojsonLayer -> formatLayerData', t => {
assert: result => {
const {layerData, layer} = result;
const expectedLayerData = {
- data: [
- updatedLayerV2.dataToFeature[2],
- updatedLayerV2.dataToFeature[4]
- ]
+ data: [updatedLayerV2.dataToFeature[2], updatedLayerV2.dataToFeature[4]]
};
const expectedDataKeys = [
'data',
@@ -135,7 +126,10 @@ test('#GeojsonLayer -> formatLayerData', t => {
);
t.deepEqual(
layerData.data.map(layerData.getFillColor),
- [[1, 2, 3], [1, 2, 3]],
+ [
+ [1, 2, 3],
+ [1, 2, 3]
+ ],
'getFillColor should return correct value'
);
t.deepEqual(
@@ -148,7 +142,10 @@ test('#GeojsonLayer -> formatLayerData', t => {
);
t.deepEqual(
layerData.data.map(layerData.getLineColor),
- [[1, 2, 3], [1, 2, 3]],
+ [
+ [1, 2, 3],
+ [1, 2, 3]
+ ],
'getLineColor should return correct value'
);
t.deepEqual(
@@ -162,11 +159,7 @@ test('#GeojsonLayer -> formatLayerData', t => {
'getRadius should return correct value'
);
// meta
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct geojson layer meta'
- );
+ t.deepEqual(layer.meta, expectedLayerMeta, 'should format correct geojson layer meta');
// dataToFeature
t.equal(
layer.dataToFeature.length,
@@ -205,12 +198,8 @@ test('#GeojsonLayer -> formatLayerData', t => {
}
},
// color by c_zip_type(string)
- colorField: preparedGeoDataset.fields.find(
- f => f.name === 'c_zip_type'
- ),
- strokeColorField: preparedGeoDataset.fields.find(
- f => f.name === 'c_zip_type'
- ),
+ colorField: preparedGeoDataset.fields.find(f => f.name === 'c_zip_type'),
+ strokeColorField: preparedGeoDataset.fields.find(f => f.name === 'c_zip_type'),
// stroke by c_number(real)
sizeField: preparedGeoDataset.fields.find(f => f.name === 'c_number'),
@@ -227,10 +216,7 @@ test('#GeojsonLayer -> formatLayerData', t => {
assert: result => {
const {layerData, layer} = result;
const expectedLayerData = {
- data: [
- updatedLayerV2.dataToFeature[2],
- updatedLayerV2.dataToFeature[4]
- ]
+ data: [updatedLayerV2.dataToFeature[2], updatedLayerV2.dataToFeature[4]]
};
const expectedDataKeys = [
'data',
@@ -267,7 +253,10 @@ test('#GeojsonLayer -> formatLayerData', t => {
// by c_zip_type
// 'C_Medium_High' null 'A_Low_Rural',
layerData.data.map(layerData.getFillColor),
- [[2, 2, 2], [2, 2, 2]],
+ [
+ [2, 2, 2],
+ [2, 2, 2]
+ ],
'getFillColor should return correct value'
);
@@ -285,7 +274,10 @@ test('#GeojsonLayer -> formatLayerData', t => {
// by c_zip_type
// 'C_Medium_High' null 'A_Low_Rural',
layerData.data.map(layerData.getLineColor),
- [[5, 5, 5], [5, 5, 5]],
+ [
+ [5, 5, 5],
+ [5, 5, 5]
+ ],
'getLineColor should return correct value'
);
t.deepEqual(
@@ -303,11 +295,7 @@ test('#GeojsonLayer -> formatLayerData', t => {
'getRadius should return correct value'
);
// meta
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct geojson layerData'
- );
+ t.deepEqual(layer.meta, expectedLayerMeta, 'should format correct geojson layerData');
// dataToFeature
t.deepEqual(
layer.dataToFeature,
@@ -376,7 +364,11 @@ test('#GeojsonLayer -> formatLayerData', t => {
);
t.deepEqual(
layerData.data.map(layerData.getFillColor),
- [[5, 5, 5], [5, 5, 5], [5, 5, 5]],
+ [
+ [5, 5, 5],
+ [5, 5, 5],
+ [5, 5, 5]
+ ],
'getFillColor should return correct value'
);
t.deepEqual(
@@ -390,7 +382,11 @@ test('#GeojsonLayer -> formatLayerData', t => {
);
t.deepEqual(
layerData.data.map(layerData.getLineColor),
- [[5, 5, 5], [5, 5, 5], [5, 5, 5]],
+ [
+ [5, 5, 5],
+ [5, 5, 5],
+ [5, 5, 5]
+ ],
'getLineColor should return correct value'
);
t.deepEqual(
@@ -405,11 +401,7 @@ test('#GeojsonLayer -> formatLayerData', t => {
);
// meta
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct geojson layer meta'
- );
+ t.deepEqual(layer.meta, expectedLayerMeta, 'should format correct geojson layer meta');
// dataToFeature
t.deepEqual(
layer.dataToFeature,
@@ -474,17 +466,29 @@ test('#GeojsonLayer -> formatLayerData', t => {
);
t.deepEqual(
layerData.data.map(layerData.getFillColor),
- [[1, 2, 3], [7, 8, 9], [1, 2, 3]],
+ [
+ [1, 2, 3],
+ [7, 8, 9],
+ [1, 2, 3]
+ ],
'getFillColor should return correct value'
);
t.deepEqual(
layerData.data.map(layerData.getFilterValue),
- [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
+ [
+ [0, 0, 0, 0],
+ [0, 0, 0, 0],
+ [0, 0, 0, 0]
+ ],
'getFilterValue should return correct value'
);
t.deepEqual(
layerData.data.map(layerData.getLineColor),
- [[4, 5, 6], [4, 5, 6], [4, 5, 6]],
+ [
+ [4, 5, 6],
+ [4, 5, 6],
+ [4, 5, 6]
+ ],
'getLineColor should return correct value'
);
t.deepEqual(
@@ -499,11 +503,7 @@ test('#GeojsonLayer -> formatLayerData', t => {
);
// meta
- t.deepEqual(
- layer.meta,
- expectedLayerMeta,
- 'should format correct geojson layer meta'
- );
+ t.deepEqual(layer.meta, expectedLayerMeta, 'should format correct geojson layer meta');
// dataToFeature
t.deepEqual(
layer.dataToFeature,
@@ -545,11 +545,7 @@ test('#GeojsonLayer -> renderLayer', t => {
}
},
assert: deckLayers => {
- const ids = [
- 'test_layer_1',
- 'test_layer_1-polygons-fill',
- 'test_layer_1-polygons-stroke'
- ];
+ const ids = ['test_layer_1', 'test_layer_1-polygons-fill', 'test_layer_1-polygons-stroke'];
t.deepEqual(
deckLayers.map(l => l.id),
ids,
diff --git a/test/browser/layer-tests/grid-layer-specs.js b/test/browser/layer-tests/grid-layer-specs.js
index 3446ef35b..8deaec380 100644
--- a/test/browser/layer-tests/grid-layer-specs.js
+++ b/test/browser/layer-tests/grid-layer-specs.js
@@ -50,20 +50,11 @@ test('#GridLayer -> constructor', t => {
label: 'test grid layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'taro',
- 'gridLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'taro', 'gridLayer dataId should be correct');
t.ok(layer.type === 'grid', 'type should be grid');
t.ok(layer.isAggregated === true, 'gridLayer is aggregated');
- t.ok(
- layer.config.label === 'test grid layer',
- 'label should be correct'
- );
- t.ok(
- Object.keys(layer.columnPairs).length,
- 'should have columnPairs'
- );
+ t.ok(layer.config.label === 'test grid layer', 'label should be correct');
+ t.ok(Object.keys(layer.columnPairs).length, 'should have columnPairs');
}
}
]
@@ -113,11 +104,7 @@ test('#GridLayer -> formatLayerData', t => {
Object.keys(expectedLayerData).sort(),
'layerData should have 4 keys'
);
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct grid layerData'
- );
+ t.deepEqual(layerData.data, expectedLayerData.data, 'should format correct grid layerData');
// test getPosition
t.deepEqual(
layerData.getPosition(layerData.data[0]),
@@ -148,11 +135,7 @@ test('#GridLayer -> formatLayerData', t => {
'_filterData should filter data correctly'
);
// test layer.meta
- t.deepEqual(
- layer.meta,
- pointLayerMeta,
- 'should format correct grid layer meta'
- );
+ t.deepEqual(layer.meta, pointLayerMeta, 'should format correct grid layer meta');
}
},
{
@@ -298,11 +281,7 @@ test('#GridLayer -> renderLayer', t => {
};
Object.keys(expectedProps).forEach(key => {
- t.deepEqual(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.deepEqual(props[key], expectedProps[key], `should have correct props.${key}`);
});
const expectedGridCellData = [
@@ -320,7 +299,8 @@ test('#GridLayer -> renderLayer', t => {
data: preparedDataset.allData[1]
}
],
- lonIdx: 253, latIdx: 711,
+ lonIdx: 253,
+ latIdx: 711,
filteredPoints: []
},
{
@@ -337,7 +317,8 @@ test('#GridLayer -> renderLayer', t => {
data: preparedDataset.allData[5]
}
],
- lonIdx: 255, latIdx: 709,
+ lonIdx: 255,
+ latIdx: 709,
filteredPoints: [
{
index: 4,
@@ -359,7 +340,8 @@ test('#GridLayer -> renderLayer', t => {
data: preparedDataset.allData[7]
}
],
- lonIdx: 254, latIdx: 711,
+ lonIdx: 254,
+ latIdx: 711,
filteredPoints: [
{
index: 7,
@@ -389,7 +371,7 @@ test('#GridLayer -> renderLayer', t => {
expectedGridCellData[i],
`should pass correct data:${i} to grid cell layer`
);
- })
+ });
t.deepEqual(
spyLayerCallbacks.args[0][0],
[1, 2],
@@ -397,15 +379,13 @@ test('#GridLayer -> renderLayer', t => {
);
t.deepEqual(
- cpuGridLayer.state.aggregatorState.dimensions.fillColor.sortedBins
- .sortedBins,
+ cpuGridLayer.state.aggregatorState.dimensions.fillColor.sortedBins.sortedBins,
expectedColorBins,
'should create correct color bins'
);
t.deepEqual(
- cpuGridLayer.state.aggregatorState.dimensions.elevation.sortedBins
- .sortedBins,
+ cpuGridLayer.state.aggregatorState.dimensions.elevation.sortedBins.sortedBins,
expectedElevationBins,
'should create correct elevation bins'
);
diff --git a/test/browser/layer-tests/h3-hexagon-layer-specs.js b/test/browser/layer-tests/h3-hexagon-layer-specs.js
index 3485dd1d8..c1bab1946 100644
--- a/test/browser/layer-tests/h3-hexagon-layer-specs.js
+++ b/test/browser/layer-tests/h3-hexagon-layer-specs.js
@@ -19,9 +19,6 @@
// THE SOFTWARE.
import test from 'tape';
-import React from 'react';
-import {mount} from 'enzyme';
-import sinon from 'sinon';
import moment from 'moment';
import {
@@ -35,7 +32,6 @@ import {
hexagonIdLayerMeta
} from 'test/helpers/layer-utils';
import {KeplerGlLayers} from 'layers';
-import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
import {getCentroid} from 'layers/h3-hexagon-layer/h3-utils';
import {defaultElevation} from 'layers/h3-hexagon-layer/h3-hexagon-layer';
const {H3Layer} = KeplerGlLayers;
@@ -55,16 +51,10 @@ test('#H3Layer -> constructor', t => {
label: 'test h3 layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'H3Layer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'smoothie', 'H3Layer dataId should be correct');
t.ok(layer.type === 'hexagonId', 'type should be h3');
t.ok(layer.isAggregated === false, 'H3Layer is not aggregated');
- t.ok(
- layer.config.label === 'test h3 layer',
- 'label should be correct'
- );
+ t.ok(layer.config.label === 'test h3 layer', 'label should be correct');
}
}
]
@@ -130,17 +120,9 @@ test('#H3Layer -> formatLayerData', t => {
'should format correct point layerData data'
);
// getFillColor
- t.deepEqual(
- layerData.getFillColor,
- [2, 3, 4],
- 'getFillColor should be a constant'
- );
+ t.deepEqual(layerData.getFillColor, [2, 3, 4], 'getFillColor should be a constant');
// getElevation
- t.deepEqual(
- layerData.getElevation,
- defaultElevation,
- 'getElevation should be a constant'
- );
+ t.deepEqual(layerData.getElevation, defaultElevation, 'getElevation should be a constant');
// getHexId
t.deepEqual(
layerData.data.map(layerData.getHexId),
@@ -158,11 +140,7 @@ test('#H3Layer -> formatLayerData', t => {
);
// layerMeta
- t.deepEqual(
- layer.meta,
- hexagonIdLayerMeta,
- 'should format correct point layer meta'
- );
+ t.deepEqual(layer.meta, hexagonIdLayerMeta, 'should format correct point layer meta');
}
},
{
@@ -207,7 +185,10 @@ test('#H3Layer -> formatLayerData', t => {
// range ['#010101', '#020202', '#030303']
t.deepEqual(
layerData.data.map(layerData.getFillColor),
- [[2, 2, 2], [1, 1, 1]],
+ [
+ [2, 2, 2],
+ [1, 1, 1]
+ ],
'getFillColor should be correct'
);
// getElevation
@@ -264,15 +245,8 @@ test('#H3Layer -> renderLayer', t => {
},
assert: (deckLayers, layer) => {
t.equal(layer.type, 'hexagonId', 'should create 1 hexagonId layer');
- t.equal(
- deckLayers.length,
- 2,
- 'Should create 2 deck.gl layers'
- );
- const expectedLayerIds = [
- 'test_layer_1',
- 'test_layer_1-hexagon-cell'
- ];
+ t.equal(deckLayers.length, 2, 'Should create 2 deck.gl layers');
+ const expectedLayerIds = ['test_layer_1', 'test_layer_1-hexagon-cell'];
t.deepEqual(
deckLayers.map(l => l.id),
@@ -293,11 +267,7 @@ test('#H3Layer -> renderLayer', t => {
elevationScale: 5
};
Object.keys(expectedProps).forEach(key => {
- t.deepEqual(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.deepEqual(props[key], expectedProps[key], `should have correct props.${key}`);
});
}
}
diff --git a/test/browser/layer-tests/hexagon-layer-specs.js b/test/browser/layer-tests/hexagon-layer-specs.js
index 91a9ed666..576409f00 100644
--- a/test/browser/layer-tests/hexagon-layer-specs.js
+++ b/test/browser/layer-tests/hexagon-layer-specs.js
@@ -327,7 +327,11 @@ test('#HexagonLayer -> renderLayer', t => {
const expectedProps = {
coverage: layer.config.visConfig.coverage,
radius: layer.config.visConfig.worldUnitSize * 1000,
- colorRange: [[8, 8, 8], [9, 9, 9], [7, 7, 7]],
+ colorRange: [
+ [8, 8, 8],
+ [9, 9, 9],
+ [7, 7, 7]
+ ],
colorScaleType: layer.config.colorScale,
elevationScaleType: layer.config.sizeScale,
elevationScale: layer.config.visConfig.elevationScale,
@@ -335,8 +339,14 @@ test('#HexagonLayer -> renderLayer', t => {
lowerPercentile: layer.config.visConfig.percentile[0]
};
- const expectedColorBins = [{i: 2, value: 1, counts: 1}, {i: 1, value: 2, counts: 2}];
- const expectedElevationBins = [{i: 2, value: 1, counts: 1}, {i: 1, value: 2, counts: 2}];
+ const expectedColorBins = [
+ {i: 2, value: 1, counts: 1},
+ {i: 1, value: 2, counts: 2}
+ ];
+ const expectedElevationBins = [
+ {i: 2, value: 1, counts: 1},
+ {i: 1, value: 2, counts: 2}
+ ];
t.deepEqual(
hexCellLayer.props.data,
diff --git a/test/browser/layer-tests/icon-layer-specs.js b/test/browser/layer-tests/icon-layer-specs.js
index 8b65e76ba..d25b2ca8f 100644
--- a/test/browser/layer-tests/icon-layer-specs.js
+++ b/test/browser/layer-tests/icon-layer-specs.js
@@ -58,7 +58,10 @@ const mockSvgIcons = [
[0.97, -0.5, 0],
[0.3, -0.4, 0]
],
- cells: [[0, 1, 3], [1, 2, 3]]
+ cells: [
+ [0, 1, 3],
+ [1, 2, 3]
+ ]
}
}
];
@@ -73,20 +76,11 @@ test('#IconLayer -> constructor', t => {
label: 'test icon layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'IconLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'smoothie', 'IconLayer dataId should be correct');
t.ok(layer.type === 'icon', 'type should be icon');
t.ok(layer.isAggregated === false, 'IconLayer is not aggregated');
- t.ok(
- layer.config.label === 'test icon layer',
- 'label should be correct'
- );
- t.ok(
- Object.keys(layer.columnPairs).length,
- 'should have columnPairs'
- );
+ t.ok(layer.config.label === 'test icon layer', 'label should be correct');
+ t.ok(Object.keys(layer.columnPairs).length, 'should have columnPairs');
// t.ok(spy.calledOnce, 'should call window.fetch once');
}
@@ -177,11 +171,7 @@ test('#IconLayer -> formatLayerData', t => {
'getPosition should return correct position'
);
// getFillColor
- t.deepEqual(
- layerData.getFillColor,
- [2, 3, 4],
- 'getFillColor should be a constant'
- );
+ t.deepEqual(layerData.getFillColor, [2, 3, 4], 'getFillColor should be a constant');
// getRadius
t.equal(layerData.getRadius, 1, 'getRadius should be a constant');
// getFilterValue
@@ -198,7 +188,7 @@ test('#IconLayer -> formatLayerData', t => {
);
t.deepEqual(
layerData.textLabels[0].characterSet,
- ['d','r','i','v','e','_','a','n','l','y','t','c','s','0'],
+ ['d', 'r', 'i', 'v', 'e', '_', 'a', 'n', 'l', 'y', 't', 'c', 's', '0'],
'textLabels should have correct characterSet'
);
t.deepEqual(
@@ -207,11 +197,7 @@ test('#IconLayer -> formatLayerData', t => {
'textLabels getText should have correct text'
);
// layerMeta
- t.deepEqual(
- layer.meta,
- pointLayerMeta,
- 'should format correct point layer meta'
- );
+ t.deepEqual(layer.meta, pointLayerMeta, 'should format correct point layer meta');
}
},
{
@@ -341,11 +327,7 @@ test('#IconLayer -> renderLayer', t => {
3,
'Should create 3 deck.gl layer when icon geometry is provided'
);
- const expectedLayerIds = [
- 'test_layer_1',
- 'test_layer_1-accel',
- 'test_layer_1-attach'
- ];
+ const expectedLayerIds = ['test_layer_1', 'test_layer_1-accel', 'test_layer_1-attach'];
t.deepEqual(
deckLayers.map(l => l.id),
@@ -363,11 +345,7 @@ test('#IconLayer -> renderLayer', t => {
brushingEnabled: false
};
Object.keys(expectedProps).forEach(key => {
- t.deepEqual(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.deepEqual(props[key], expectedProps[key], `should have correct props.${key}`);
});
}
},
@@ -409,11 +387,7 @@ test('#IconLayer -> renderLayer', t => {
3,
'Should create 3 deck.gl layer when icon geometry is provided'
);
- const expectedLayerIds = [
- 'test_layer_1',
- 'test_layer_1-accel',
- 'test_layer_1-attach'
- ];
+ const expectedLayerIds = ['test_layer_1', 'test_layer_1-accel', 'test_layer_1-attach'];
t.deepEqual(
deckLayers.map(l => l.id),
@@ -429,11 +403,7 @@ test('#IconLayer -> renderLayer', t => {
brushingEnabled: true
};
Object.keys(expectedProps).forEach(key => {
- t.deepEqual(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.deepEqual(props[key], expectedProps[key], `should have correct props.${key}`);
});
}
},
@@ -507,10 +477,7 @@ test('#IconLayer -> renderLayer', t => {
const padding = 20;
// anchor: start, alignment: center
- const expectedPixelOffset0 = [
- 1 * (pixelRadius + padding),
- 0 * (pixelRadius + padding + 0)
- ];
+ const expectedPixelOffset0 = [1 * (pixelRadius + padding), 0 * (pixelRadius + padding + 0)];
// anchor: 'middle', alignment: 'bottom'
const expectedPixelOffset1 = [
@@ -523,11 +490,7 @@ test('#IconLayer -> renderLayer', t => {
[testRows[0][2], testRows[0][1]],
'Should calculate correct getPosition'
);
- t.deepEqual(
- getColor,
- DEFAULT_TEXT_LABEL.color,
- 'Should calculate correct getColor'
- );
+ t.deepEqual(getColor, DEFAULT_TEXT_LABEL.color, 'Should calculate correct getColor');
t.deepEqual(getSize, 1, 'Should calculate correct getSize');
t.deepEqual(
getPixelOffset,
@@ -573,7 +536,15 @@ test('#IconLayer -> fetch icon geometry -> renderIconModal', t => {
}, 'mount layer info modal with icons should not fail');
t.equal(wrapper.find('.icon-table__item').length, 3, 'should render 1 icon');
- t.equal(wrapper.find('.icon-table_item__name').at(0).find('code').text(), 'alert', 'should render alert icon');
+ t.equal(
+ wrapper
+ .find('.icon-table_item__name')
+ .at(0)
+ .find('code')
+ .text(),
+ 'alert',
+ 'should render alert icon'
+ );
stubedFetch.restore();
t.end();
diff --git a/test/browser/layer-tests/line-layer-specs.js b/test/browser/layer-tests/line-layer-specs.js
index fe9dee660..4f1147cbc 100644
--- a/test/browser/layer-tests/line-layer-specs.js
+++ b/test/browser/layer-tests/line-layer-specs.js
@@ -51,20 +51,11 @@ test('#LineLayer -> constructor', t => {
label: 'test line layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'LineLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'smoothie', 'LineLayer dataId should be correct');
t.ok(layer.type === 'line', 'type should be line');
t.ok(layer.isAggregated === false, 'LineLayer is not aggregated');
- t.ok(
- layer.config.label === 'test line layer',
- 'label should be correct'
- );
- t.ok(
- Object.keys(layer.columnPairs).length,
- 'should have columnPairs'
- );
+ t.ok(layer.config.label === 'test line layer', 'label should be correct');
+ t.ok(Object.keys(layer.columnPairs).length, 'should have columnPairs');
}
}
]
@@ -127,11 +118,7 @@ test('#LineLayer -> formatLayerData', t => {
expectedDataKeys,
'layerData should have 6 keys'
);
- t.deepEqual(
- layerData.data,
- expectedLayerData.data,
- 'should format correct line layerData'
- );
+ t.deepEqual(layerData.data, expectedLayerData.data, 'should format correct line layerData');
// getSourceColor
t.deepEqual(
layerData.getSourceColor,
@@ -151,17 +138,13 @@ test('#LineLayer -> formatLayerData', t => {
layerData.data.map(layerData.getFilterValue),
[
[Number.MIN_SAFE_INTEGER, 0, 0, 0],
- [moment.utc(testRows[4][0]).valueOf() - filterDomain0, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - filterDomain0, 0, 0, 0]
],
'getFilterValue should return [value, 0, 0, 0]'
);
// layerMeta
- t.deepEqual(
- layer.meta,
- arcLayerMeta,
- 'should format correct arc layer meta'
- );
+ t.deepEqual(layer.meta, arcLayerMeta, 'should format correct arc layer meta');
}
},
{
@@ -186,7 +169,7 @@ test('#LineLayer -> formatLayerData', t => {
const {layerData, layer} = result;
const expectedLayerData = {
- data: [],
+ data: [],
getFilterValue: () => {},
getSourceColor: () => {},
getTargetColor: () => {},
@@ -206,11 +189,7 @@ test('#LineLayer -> formatLayerData', t => {
'getSourceColor should be a constant'
);
// getSourceColor
- t.deepEqual(
- layerData.getTargetColor,
- [1, 2, 3],
- 'getTargetColors should be a constant'
- );
+ t.deepEqual(layerData.getTargetColor, [1, 2, 3], 'getTargetColors should be a constant');
}
},
{
@@ -287,7 +266,10 @@ test('#LineLayer -> formatLayerData', t => {
// range ['#010101', '#020202', '#030303']
t.deepEqual(
layerData.data.map(layerData.getSourceColor),
- [[2, 2, 2], [1, 1, 1]],
+ [
+ [2, 2, 2],
+ [1, 1, 1]
+ ],
'getSourceColor should be correct'
);
// getTargetColor
@@ -295,7 +277,10 @@ test('#LineLayer -> formatLayerData', t => {
// range ['#010101', '#020202', '#030303']
t.deepEqual(
layerData.data.map(layerData.getTargetColor),
- [[2, 2, 2], [1, 1, 1]],
+ [
+ [2, 2, 2],
+ [1, 1, 1]
+ ],
'getTargetColors be correct'
);
// getWidth
@@ -312,7 +297,7 @@ test('#LineLayer -> formatLayerData', t => {
layerData.data.map(layerData.getFilterValue),
[
[Number.MIN_SAFE_INTEGER, 0, 0, 0],
- [moment.utc(testRows[4][0]).valueOf() - filterDomain0, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - filterDomain0, 0, 0, 0]
],
'getFilterValue should return [value, 0, 0, 0]'
);
@@ -350,15 +335,17 @@ test('#LineLayer -> renderLayer', t => {
t.equal(deckLayers.length, 1, 'Should create 1 deck.gl layer');
const {props} = deckLayers[0];
// test instancePositions
+ t.equal(props.opacity, layer.config.visConfig.opacity, 'should calculate correct opacity');
t.equal(
- props.opacity, layer.config.visConfig.opacity, 'should calculate correct opacity'
+ props.widthScale,
+ layer.config.visConfig.thickness,
+ 'should apply correct widthScale'
);
t.equal(
- props.widthScale, layer.config.visConfig.thickness, 'should apply correct widthScale'
- )
- t.equal(
- props.filterRange, preparedDataset.gpuFilter.filterRange, 'should supply correct filterRange'
- )
+ props.filterRange,
+ preparedDataset.gpuFilter.filterRange,
+ 'should supply correct filterRange'
+ );
}
},
{
@@ -394,15 +381,9 @@ test('#LineLayer -> renderLayer', t => {
const {props} = deckLayers[0];
// test instancePositions
- t.equal(
- props.brushingRadius, 2500, 'should supply brushingRadius'
- );
- t.equal(
- props.brushingEnabled, true, 'should have brushingEnabled: true'
- );
- t.equal(
- props.brushingTarget, 'source_target', 'brushingTarget: should be source'
- )
+ t.equal(props.brushingRadius, 2500, 'should supply brushingRadius');
+ t.equal(props.brushingEnabled, true, 'should have brushingEnabled: true');
+ t.equal(props.brushingTarget, 'source_target', 'brushingTarget: should be source');
}
}
];
diff --git a/test/browser/layer-tests/point-layer-specs.js b/test/browser/layer-tests/point-layer-specs.js
index f65975a42..8ad8273a4 100644
--- a/test/browser/layer-tests/point-layer-specs.js
+++ b/test/browser/layer-tests/point-layer-specs.js
@@ -48,16 +48,10 @@ test('#PointLayer -> constructor', t => {
label: 'test point layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'PointLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'smoothie', 'PointLayer dataId should be correct');
t.ok(layer.type === 'point', 'type should be point');
t.ok(layer.isAggregated === false, 'PointLayer is not aggregated');
- t.ok(
- layer.config.label === 'test point layer',
- 'label should be correct'
- );
+ t.ok(layer.config.label === 'test point layer', 'label should be correct');
t.deepEqual(
layer.columnPairs,
{
@@ -174,11 +168,7 @@ test('#PointLayer -> formatLayerData', t => {
'getFillColor should be a constant'
);
// getLineColor
- t.deepEqual(
- layerData.getLineColor,
- [1, 2, 3],
- 'getLineColor should be a constant'
- );
+ t.deepEqual(layerData.getLineColor, [1, 2, 3], 'getLineColor should be a constant');
// getRadius
t.equal(layerData.getRadius, 1, 'getRadius should be a constant');
// getFilterValue
@@ -198,7 +188,7 @@ test('#PointLayer -> formatLayerData', t => {
);
t.deepEqual(
layerData.textLabels[0].characterSet,
- ['d','r','i','v','e','_','a','n','l','y','t','c','s','0'],
+ ['d', 'r', 'i', 'v', 'e', '_', 'a', 'n', 'l', 'y', 't', 'c', 's', '0'],
'textLabels should have correct characterSet'
);
t.deepEqual(
@@ -207,11 +197,7 @@ test('#PointLayer -> formatLayerData', t => {
'textLabels getText should have correct text'
);
// layerMeta
- t.deepEqual(
- layer.meta,
- pointLayerMeta,
- 'should format correct point layer meta'
- );
+ t.deepEqual(layer.meta, pointLayerMeta, 'should format correct point layer meta');
}
},
{
@@ -279,11 +265,7 @@ test('#PointLayer -> formatLayerData', t => {
Object.keys(expectedLayerData).sort,
'layerData should have 7 keys'
);
- t.deepEqual(
- layer.config.colorDomain,
- fieldDomain.id,
- 'should update layer color domain'
- );
+ t.deepEqual(layer.config.colorDomain, fieldDomain.id, 'should update layer color domain');
t.deepEqual(
layerData.data,
expectedLayerData.data,
@@ -296,11 +278,7 @@ test('#PointLayer -> formatLayerData', t => {
'getPosition should return correct lat lng'
);
// layerMeta
- t.deepEqual(
- layer.meta,
- pointLayerMeta,
- 'should format correct layerMeta'
- );
+ t.deepEqual(layer.meta, pointLayerMeta, 'should format correct layerMeta');
// getFillColor
t.deepEqual(
layerData.getFillColor(layerData.data[0]),
@@ -308,18 +286,10 @@ test('#PointLayer -> formatLayerData', t => {
'getFillColor should return correct color'
);
// getLineColor
- t.deepEqual(
- layerData.getLineColor,
- [4, 5, 6],
- 'getLineColor should return correct color'
- );
+ t.deepEqual(layerData.getLineColor, [4, 5, 6], 'getLineColor should return correct color');
// getRadius
// domain [1, 12124]
- t.equal(
- layerData.getRadius(layerData.data[0]),
- 1,
- 'getRadius should return fixed radius'
- );
+ t.equal(layerData.getRadius(layerData.data[0]), 1, 'getRadius should return fixed radius');
}
},
{
@@ -478,11 +448,7 @@ test('#PointLayer -> renderLayer', t => {
filterRange: preparedDataset.gpuFilter.filterRange
};
Object.keys(expectedProps).forEach(key => {
- t.deepEqual(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.deepEqual(props[key], expectedProps[key], `should have correct props.${key}`);
});
}
},
@@ -557,10 +523,7 @@ test('#PointLayer -> renderLayer', t => {
const padding = 20;
// anchor: start, alignment: center
- const expectedPixelOffset0 = [
- 1 * (pixelRadius + padding),
- 0 * (pixelRadius + padding + 0)
- ];
+ const expectedPixelOffset0 = [1 * (pixelRadius + padding), 0 * (pixelRadius + padding + 0)];
// anchor: 'middle', alignment: 'bottom'
const expectedPixelOffset1 = [
@@ -573,11 +536,7 @@ test('#PointLayer -> renderLayer', t => {
[testRows[0][2], testRows[0][1], 1],
'Should calculate correct getPosition'
);
- t.deepEqual(
- getColor,
- DEFAULT_TEXT_LABEL.color,
- 'Should calculate correct getColor'
- );
+ t.deepEqual(getColor, DEFAULT_TEXT_LABEL.color, 'Should calculate correct getColor');
t.deepEqual(getSize, 1, 'Should calculate correct getSize');
t.deepEqual(
getPixelOffset,
@@ -640,11 +599,7 @@ test('#PointLayer -> renderLayer', t => {
assert: (deckLayers, layer, layerData) => {
t.deepEqual(
deckLayers.map(l => l.id),
- [
- 'test_layer_1',
- 'test_layer_1-label-types',
- 'test_layer_1-label-types-characters'
- ],
+ ['test_layer_1', 'test_layer_1-label-types', 'test_layer_1-label-types-characters'],
'Should create 3 deck.gl layers'
);
// test test_layer_1-label-types
@@ -670,9 +625,6 @@ test('#PointLayer -> renderLayer', t => {
expectedPixelOffset1,
'Should calculate correct instancePixelOffset multiplied by getRadius'
);
-
-
- const {attributes} = deckLayers[0].state.attributeManager;
}
}
];
diff --git a/test/browser/layer-tests/scenegraph-layer-specs.js b/test/browser/layer-tests/scenegraph-layer-specs.js
index b0cf78ef3..137c721a8 100644
--- a/test/browser/layer-tests/scenegraph-layer-specs.js
+++ b/test/browser/layer-tests/scenegraph-layer-specs.js
@@ -23,7 +23,7 @@ import moment from 'moment';
import global from 'global';
import sinon from 'sinon';
import sinonStubPromise from 'sinon-stub-promise';
-sinonStubPromise(sinon)
+sinonStubPromise(sinon);
import {
testCreateCases,
@@ -49,23 +49,11 @@ test('#ScenegraphLayer -> constructor', t => {
label: 'test 3d layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'ScenegraphLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'smoothie', 'ScenegraphLayer dataId should be correct');
t.ok(layer.type === '3D', 'type should be 3D');
- t.ok(
- layer.isAggregated === false,
- 'ScenegraphLayer is not aggregated'
- );
- t.ok(
- layer.config.label === 'test 3d layer',
- 'label should be correct'
- );
- t.ok(
- Object.keys(layer.columnPairs).length,
- 'should have columnPairs'
- );
+ t.ok(layer.isAggregated === false, 'ScenegraphLayer is not aggregated');
+ t.ok(layer.config.label === 'test 3d layer', 'label should be correct');
+ t.ok(Object.keys(layer.columnPairs).length, 'should have columnPairs');
}
}
]
@@ -138,16 +126,12 @@ test('#ScenegraphLayer -> formatLayerData', t => {
layerData.data.map(layerData.getFilterValue),
[
[Number.MIN_SAFE_INTEGER, 0, 0, 0],
- [moment.utc(testRows[4][0]).valueOf() - preparedFilterDomain0, 0, 0, 0],
+ [moment.utc(testRows[4][0]).valueOf() - preparedFilterDomain0, 0, 0, 0]
],
'getFilterValue should return [value, 0, 0, 0]'
);
// layerMeta
- t.deepEqual(
- layer.meta,
- pointLayerMeta,
- 'should format correct point layer meta'
- );
+ t.deepEqual(layer.meta, pointLayerMeta, 'should format correct point layer meta');
}
}
];
@@ -157,7 +141,6 @@ test('#ScenegraphLayer -> formatLayerData', t => {
});
test('#ScenegraphLayer -> renderLayer', t => {
-
// TODO: mock actual gltf response
const mockSuccessResponse = {};
const mockJsonPromise = sinon.stub().returnsPromise();
@@ -196,16 +179,13 @@ test('#ScenegraphLayer -> renderLayer', t => {
opacity: layer.config.visConfig.opacity,
sizeScale: layer.config.visConfig.sizeScale,
filterRange: preparedDataset.gpuFilter.filterRange
- }
+ };
Object.keys(expectedProps).forEach(key => {
- t.equal(
- props[key],
- expectedProps[key],
- `should have correct props.${key}`
- );
+ t.equal(props[key], expectedProps[key], `should have correct props.${key}`);
});
}
- }];
+ }
+ ];
testRenderLayerCases(t, ScenegraphLayer, TEST_CASES);
diff --git a/test/browser/layer-tests/trip-layer-specs.js b/test/browser/layer-tests/trip-layer-specs.js
index 0827bc8a6..40c952cfb 100644
--- a/test/browser/layer-tests/trip-layer-specs.js
+++ b/test/browser/layer-tests/trip-layer-specs.js
@@ -31,11 +31,7 @@ import {
valueFilterDomain0,
animationConfig
} from 'test/helpers/layer-utils';
-import {
- TripLayerMeta,
- dataToFeature,
- dataToTimeStamp
-} from 'test/fixtures/trip-geojson';
+import {TripLayerMeta, dataToFeature, dataToTimeStamp} from 'test/fixtures/trip-geojson';
test('#TripLayer -> constructor', t => {
const TEST_CASES = {
@@ -47,10 +43,7 @@ test('#TripLayer -> constructor', t => {
label: 'test trip layer'
},
test: layer => {
- t.ok(
- layer.config.dataId === 'smoothie',
- 'tripnLayer dataId should be correct'
- );
+ t.ok(layer.config.dataId === 'smoothie', 'tripnLayer dataId should be correct');
t.ok(layer.type === 'trip', 'type should be trip');
t.ok(layer.isAggregated === false, 'tripLayer is not aggregated');
}
@@ -347,8 +340,11 @@ test('#TripLayer -> renderLayer', t => {
let currentIdx = 0;
let count = 0;
- for (let c = 0; c < attributes.instancePickingColors.value.length; c+=3) {
- if (attributes.instancePickingColors.value[c] > currentIdx || c === attributes.instancePickingColors.value.length - 3) {
+ for (let c = 0; c < attributes.instancePickingColors.value.length; c += 3) {
+ if (
+ attributes.instancePickingColors.value[c] > currentIdx ||
+ c === attributes.instancePickingColors.value.length - 3
+ ) {
currentIdx = attributes.instancePickingColors.value[c];
if (count > 0) {
numVertexs.push(count);
diff --git a/test/fixtures/config_v0_arc_cluster_point.js b/test/fixtures/config_v0_arc_cluster_point.js
index 35ecb9dc2..ff1670b4d 100644
--- a/test/fixtures/config_v0_arc_cluster_point.js
+++ b/test/fixtures/config_v0_arc_cluster_point.js
@@ -62,14 +62,7 @@ export const savedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
sizeRange: [0, 10],
'hi-precision': false
@@ -106,14 +99,7 @@ export const savedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [1, 40],
'hi-precision': false
@@ -159,14 +145,7 @@ export const savedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [0, 50],
'hi-precision': false
@@ -209,14 +188,7 @@ export const savedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [0, 50],
'hi-precision': false
@@ -259,14 +231,7 @@ export const savedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [0, 50],
'hi-precision': false
@@ -341,14 +306,7 @@ export const parsedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
sizeRange: [0, 10],
'hi-precision': false
@@ -380,14 +338,7 @@ export const parsedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [1, 40],
'hi-precision': false,
@@ -424,27 +375,13 @@ export const parsedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColorRange: {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColor: [218, 112, 191],
radiusRange: [0, 50],
@@ -479,28 +416,14 @@ export const parsedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColor: [255, 153, 31],
strokeColorRange: {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [0, 50],
'hi-precision': false
@@ -534,28 +457,14 @@ export const parsedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColor: [130, 154, 227],
strokeColorRange: {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [0, 50],
'hi-precision': false
diff --git a/test/fixtures/config_v0_geojson_point.js b/test/fixtures/config_v0_geojson_point.js
index 693a731e8..7d66ceae1 100644
--- a/test/fixtures/config_v0_geojson_point.js
+++ b/test/fixtures/config_v0_geojson_point.js
@@ -50,14 +50,7 @@ export const savedConfigV0 = {
name: 'ColorBrewer Dark2-6',
type: 'qualitative',
category: 'ColorBrewer',
- colors: [
- '#1b9e77',
- '#d95f02',
- '#7570b3',
- '#e7298a',
- '#66a61e',
- '#e6ab02'
- ],
+ colors: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02'],
reversed: false
},
opacity: 0.8,
@@ -139,28 +132,14 @@ export const parsedConfigV0 = {
name: 'ColorBrewer Dark2-6',
type: 'qualitative',
category: 'ColorBrewer',
- colors: [
- '#1b9e77',
- '#d95f02',
- '#7570b3',
- '#e7298a',
- '#66a61e',
- '#e6ab02'
- ],
+ colors: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02'],
reversed: false
},
strokeColorRange: {
name: 'ColorBrewer Dark2-6',
type: 'qualitative',
category: 'ColorBrewer',
- colors: [
- '#1b9e77',
- '#d95f02',
- '#7570b3',
- '#e7298a',
- '#66a61e',
- '#e6ab02'
- ],
+ colors: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02'],
reversed: false
},
strokeColor: [174, 14, 127],
diff --git a/test/fixtures/config_v0_geojson_poly_fill_ele.js b/test/fixtures/config_v0_geojson_poly_fill_ele.js
index ffedd3d2c..0deacb855 100644
--- a/test/fixtures/config_v0_geojson_poly_fill_ele.js
+++ b/test/fixtures/config_v0_geojson_poly_fill_ele.js
@@ -84,14 +84,7 @@ export const savedConfigV0 = {
visConfig: {
colorRange: {
category: 'ColorBrewer',
- colors: [
- '#ffffcc',
- '#d9f0a3',
- '#addd8e',
- '#78c679',
- '#31a354',
- '#006837'
- ],
+ colors: ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'],
name: 'ColorBrewer YlGn-6',
reversed: false,
type: 'sequential'
@@ -181,28 +174,14 @@ export const parsedConfigV0 = {
visConfig: {
colorRange: {
category: 'ColorBrewer',
- colors: [
- '#ffffcc',
- '#d9f0a3',
- '#addd8e',
- '#78c679',
- '#31a354',
- '#006837'
- ],
+ colors: ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'],
name: 'ColorBrewer YlGn-6',
reversed: false,
type: 'sequential'
},
strokeColorRange: {
category: 'ColorBrewer',
- colors: [
- '#ffffcc',
- '#d9f0a3',
- '#addd8e',
- '#78c679',
- '#31a354',
- '#006837'
- ],
+ colors: ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'],
name: 'ColorBrewer YlGn-6',
reversed: false,
type: 'sequential'
diff --git a/test/fixtures/config_v0_geojson_polygon.js b/test/fixtures/config_v0_geojson_polygon.js
index e9e796273..b292358d1 100644
--- a/test/fixtures/config_v0_geojson_polygon.js
+++ b/test/fixtures/config_v0_geojson_polygon.js
@@ -105,14 +105,7 @@ export const savedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
opacity: 0.8,
thickness: 8,
@@ -258,28 +251,14 @@ export const parsedConfigV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColor: [136, 87, 44, 255],
strokeColorRange: {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
opacity: 0.8,
thickness: 8,
diff --git a/test/fixtures/geojson.js b/test/fixtures/geojson.js
index ccc05a735..3bc02b9bd 100644
--- a/test/fixtures/geojson.js
+++ b/test/fixtures/geojson.js
@@ -188,7 +188,7 @@ const feature4 = {
]
]
}
-}
+};
const feature4Parsed = {
type: 'Feature',
@@ -487,9 +487,7 @@ export const updatedGeoJsonLayer = {
}
};
-export const mappedTripValue = geojsonData.features.map(
- f => f.properties.TRIPS
-);
+export const mappedTripValue = geojsonData.features.map(f => f.properties.TRIPS);
export const tripDomain = extent(mappedTripValue);
@@ -592,12 +590,7 @@ export const geoStyleDataToFeature = geoJsonWithStyle.features.map((f, i) => ({
properties: {...f.properties, index: i}
}));
-export const geoStyleBounds = [
- -122.3,
- 37.1,
- -122.1,
- 37.3
-];
+export const geoStyleBounds = [-122.3, 37.1, -122.1, 37.3];
export const geoStyleMeta = {
featureTypes: {point: true},
diff --git a/test/fixtures/polygon-filter-map.js b/test/fixtures/polygon-filter-map.js
index 34cbb707a..4bf08bb0e 100644
--- a/test/fixtures/polygon-filter-map.js
+++ b/test/fixtures/polygon-filter-map.js
@@ -25,11 +25,7 @@ export const polygonFilterMap = {
data: {
id: '9bluyz5s2',
label: 'kepler-gl_new dataset (3).csv',
- color: [
- 143,
- 47,
- 191
- ],
+ color: [143, 47, 191],
allData: [
[
'1967/08/01 10:33:50.47',
@@ -255,13 +251,9 @@ export const polygonFilterMap = {
visState: {
filters: [
{
- dataId: [
- '9bluyz5s2'
- ],
+ dataId: ['9bluyz5s2'],
id: '1545pmr0s',
- name: [
- 'Point'
- ],
+ name: ['Point'],
type: 'polygon',
value: {
type: 'Feature',
@@ -269,26 +261,11 @@ export const polygonFilterMap = {
type: 'Polygon',
coordinates: [
[
- [
- -121.20301917819414,
- 36.19054006644038
- ],
- [
- -121.20301917819414,
- 36.05580399351024
- ],
- [
- -120.91706956830599,
- 36.05580399351024
- ],
- [
- -120.91706956830599,
- 36.19054006644038
- ],
- [
- -121.20301917819414,
- 36.19054006644038
- ]
+ [-121.20301917819414, 36.19054006644038],
+ [-121.20301917819414, 36.05580399351024],
+ [-120.91706956830599, 36.05580399351024],
+ [-120.91706956830599, 36.19054006644038],
+ [-121.20301917819414, 36.19054006644038]
]
]
},
@@ -308,9 +285,7 @@ export const polygonFilterMap = {
plotType: 'histogram',
yAxis: null,
fixedDomain: true,
- layerId: [
- 'i1w1f0m'
- ]
+ layerId: ['i1w1f0m']
}
],
layers: [
@@ -320,11 +295,7 @@ export const polygonFilterMap = {
config: {
dataId: '9bluyz5s2',
label: 'Point',
- color: [
- 183,
- 136,
- 94
- ],
+ color: [183, 136, 94],
columns: {
lat: 'Latitude',
lng: 'Longitude',
@@ -342,47 +313,23 @@ export const polygonFilterMap = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColorRange: {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
- radiusRange: [
- 0,
- 50
- ],
+ radiusRange: [0, 50],
filled: true
},
textLabel: [
{
field: null,
- color: [
- 255,
- 255,
- 255
- ],
+ color: [255, 255, 255],
size: 18,
- offset: [
- 0,
- 0
- ],
+ offset: [0, 0],
anchor: 'start',
alignment: 'center'
}
@@ -401,13 +348,7 @@ export const polygonFilterMap = {
interactionConfig: {
tooltip: {
fieldsToShow: {
- '9bluyz5s2': [
- 'DateTime',
- 'Latitude',
- 'Longitude',
- 'Depth',
- 'Magnitude'
- ]
+ '9bluyz5s2': ['DateTime', 'Latitude', 'Longitude', 'Depth', 'Magnitude']
},
enabled: true
},
@@ -444,11 +385,7 @@ export const polygonFilterMap = {
land: true,
'3d building': false
},
- threeDBuildingColor: [
- 9.665468314072013,
- 17.18305478057247,
- 31.1442867897876
- ],
+ threeDBuildingColor: [9.665468314072013, 17.18305478057247, 31.1442867897876],
mapStyles: {}
}
}
diff --git a/test/fixtures/polygon.js b/test/fixtures/polygon.js
index 8e181a5dd..fe193a129 100644
--- a/test/fixtures/polygon.js
+++ b/test/fixtures/polygon.js
@@ -24,26 +24,11 @@ export const mockPolygonFeature = {
type: 'Polygon',
coordinates: [
[
- [
- 28.66601562502387,
- 15.343585399424173
- ],
- [
- 28.66601562502387,
- 11.109477534559822
- ],
- [
- 32.75292968752382,
- 11.109477534559822
- ],
- [
- 32.75292968752382,
- 15.343585399424173
- ],
- [
- 28.66601562502387,
- 15.343585399424173
- ]
+ [28.66601562502387, 15.343585399424173],
+ [28.66601562502387, 11.109477534559822],
+ [32.75292968752382, 11.109477534559822],
+ [32.75292968752382, 15.343585399424173],
+ [28.66601562502387, 15.343585399424173]
]
]
},
@@ -92,11 +77,7 @@ export const mockPolygonData = {
config: {
dataId: 'puppy',
label: 'start point',
- color: [
- 227,
- 26,
- 26
- ],
+ color: [227, 26, 26],
columns: {
lat: 'start_point_lat',
lng: 'start_point_lng',
@@ -114,47 +95,23 @@ export const mockPolygonData = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColorRange: {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
- radiusRange: [
- 0,
- 50
- ],
+ radiusRange: [0, 50],
filled: true
},
textLabel: [
{
field: null,
- color: [
- 255,
- 255,
- 255
- ],
+ color: [255, 255, 255],
size: 18,
- offset: [
- 0,
- 0
- ],
+ offset: [0, 0],
anchor: 'start',
alignment: 'center'
}
@@ -175,11 +132,7 @@ export const mockPolygonData = {
config: {
dataId: 'puppy',
label: 'end point',
- color: [
- 255,
- 203,
- 153
- ],
+ color: [255, 203, 153],
columns: {
lat: 'end_point_lat',
lng: 'end_point_lng',
@@ -197,47 +150,23 @@ export const mockPolygonData = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColorRange: {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
- radiusRange: [
- 0,
- 50
- ],
+ radiusRange: [0, 50],
filled: true
},
textLabel: [
{
field: null,
- color: [
- 255,
- 255,
- 255
- ],
+ color: [255, 255, 255],
size: 18,
- offset: [
- 0,
- 0
- ],
+ offset: [0, 0],
anchor: 'start',
alignment: 'center'
}
diff --git a/test/fixtures/state-saved-v0.js b/test/fixtures/state-saved-v0.js
index 5a36e58b9..fb44bf8fb 100644
--- a/test/fixtures/state-saved-v0.js
+++ b/test/fixtures/state-saved-v0.js
@@ -230,14 +230,7 @@ export const savedStateV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [1, 100],
'hi-precision': false
@@ -280,14 +273,7 @@ export const savedStateV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
sizeRange: [0, 10],
'hi-precision': false
@@ -370,14 +356,7 @@ export const savedStateV0 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
coverage: 1,
sizeRange: [0, 50],
@@ -912,7 +891,7 @@ export const mergedFilters = [
name: ['song_name'],
type: 'multiSelect',
fieldIdx: [0],
- domain: ['2.103.2', '2.107.3', '2.116.2', '2.117.1', '3.68.4' ],
+ domain: ['2.103.2', '2.107.3', '2.116.2', '2.117.1', '3.68.4'],
value: ['3.68.4', '2.117.1', '2.103.2', '2.116.2'],
fieldType: 'string',
plotType: 'histogram',
@@ -1469,24 +1448,13 @@ mergedLayer4.dataToFeature = {
};
mergedLayer4.meta = {
- bounds: [
- -122.50828762723958,
- 37.733266432915535,
- -122.39989147796784,
- 37.787534455433345
- ],
+ bounds: [-122.50828762723958, 37.733266432915535, -122.39989147796784, 37.787534455433345],
featureTypes: {polygon: true},
fp64: false,
fixedRadius: false
};
-export const mergedLayers = [
- mergedLayer0,
- mergedLayer1,
- mergedLayer2,
- mergedLayer3,
- mergedLayer4
-];
+export const mergedLayers = [mergedLayer0, mergedLayer1, mergedLayer2, mergedLayer3, mergedLayer4];
const defaultInteraction = getDefaultInteraction();
export const mergedInteractions = {
diff --git a/test/fixtures/state-saved-v1-1.js b/test/fixtures/state-saved-v1-1.js
index 57ec48f91..e1fcc9122 100644
--- a/test/fixtures/state-saved-v1-1.js
+++ b/test/fixtures/state-saved-v1-1.js
@@ -715,14 +715,7 @@ export const savedStateV1 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radius: 10,
sizeRange: [18.9, 47.6],
@@ -817,7 +810,12 @@ export const v0ExpectedInfo = {
export const v0ExpectedFields = [
{name: 'a_zip', type: 'integer', format: '', analyzerType: 'INT'},
- {name: 'simplified_shape_v2', type: 'geojson', format: '', analyzerType: 'PAIR_GEOMETRY_FROM_STRING'},
+ {
+ name: 'simplified_shape_v2',
+ type: 'geojson',
+ format: '',
+ analyzerType: 'PAIR_GEOMETRY_FROM_STRING'
+ },
{name: 'simplified_shape', type: 'geojson', format: '', analyzerType: 'GEOMETRY_FROM_STRING'},
{name: 'zip_area', type: 'real', format: '', analyzerType: 'FLOAT'},
{name: 'avg_number', type: 'real', format: '', analyzerType: 'FLOAT'},
diff --git a/test/fixtures/state-saved-v1-2.js b/test/fixtures/state-saved-v1-2.js
index e1ef96926..6f21da1b0 100644
--- a/test/fixtures/state-saved-v1-2.js
+++ b/test/fixtures/state-saved-v1-2.js
@@ -65,14 +65,7 @@ export const stateSavedV1_2 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [0, 50],
'hi-precision': false
@@ -89,13 +82,7 @@ export const stateSavedV1_2 = {
interactionConfig: {
tooltip: {
fieldsToShow: {
- test_phone_data: [
- 'uuid',
- 'Latitude',
- 'Longitude',
- 'at_Latitude',
- 'at_Longitude'
- ]
+ test_phone_data: ['uuid', 'Latitude', 'Longitude', 'at_Latitude', 'at_Longitude']
},
enabled: true
},
diff --git a/test/fixtures/state-saved-v1-3.js b/test/fixtures/state-saved-v1-3.js
index 92c86e970..0f118f6f9 100644
--- a/test/fixtures/state-saved-v1-3.js
+++ b/test/fixtures/state-saved-v1-3.js
@@ -225,14 +225,7 @@ export const savedStateV1 = {
name: 'ColorBrewer YlGn-6',
type: 'sequential',
category: 'ColorBrewer',
- colors: [
- '#006837',
- '#31a354',
- '#78c679',
- '#addd8e',
- '#d9f0a3',
- '#ffffcc'
- ],
+ colors: ['#006837', '#31a354', '#78c679', '#addd8e', '#d9f0a3', '#ffffcc'],
reversed: true
},
radiusRange: [0, 50]
@@ -262,13 +255,7 @@ export const savedStateV1 = {
name: 'Uber Viz Diverging 1',
type: 'diverging',
category: 'Uber',
- colors: [
- '#00939C',
- '#85C4C8',
- '#FEEEE8',
- '#EC9370',
- '#C22E00'
- ],
+ colors: ['#00939C', '#85C4C8', '#FEEEE8', '#EC9370', '#C22E00'],
reversed: false
},
coverage: 1,
@@ -292,13 +279,7 @@ export const savedStateV1 = {
interactionConfig: {
tooltip: {
fieldsToShow: {
- fm8v2jcza: [
- 'deliver_radius',
- 'boolean',
- 'num_boolean',
- 'int',
- 'boolean_1'
- ]
+ fm8v2jcza: ['deliver_radius', 'boolean', 'num_boolean', 'int', 'boolean_1']
},
enabled: true
},
@@ -416,28 +397,14 @@ mergedLayer0.config = {
name: 'ColorBrewer YlGn-6',
type: 'sequential',
category: 'ColorBrewer',
- colors: [
- '#006837',
- '#31a354',
- '#78c679',
- '#addd8e',
- '#d9f0a3',
- '#ffffcc'
- ],
+ colors: ['#006837', '#31a354', '#78c679', '#addd8e', '#d9f0a3', '#ffffcc'],
reversed: true
},
strokeColorRange: {
name: 'ColorBrewer YlGn-6',
type: 'sequential',
category: 'ColorBrewer',
- colors: [
- '#006837',
- '#31a354',
- '#78c679',
- '#addd8e',
- '#d9f0a3',
- '#ffffcc'
- ],
+ colors: ['#006837', '#31a354', '#78c679', '#addd8e', '#d9f0a3', '#ffffcc'],
reversed: true
},
radiusRange: [0, 50],
diff --git a/test/fixtures/state-saved-v1-4.js b/test/fixtures/state-saved-v1-4.js
index 875122c1f..fc49b729e 100644
--- a/test/fixtures/state-saved-v1-4.js
+++ b/test/fixtures/state-saved-v1-4.js
@@ -115,14 +115,7 @@ export const stateSavedV1 = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [0, 50],
'hi-precision': false
@@ -149,13 +142,7 @@ export const stateSavedV1 = {
interactionConfig: {
tooltip: {
fieldsToShow: {
- '8ppj5gfrs': [
- 'radius',
- 'boolean',
- 'num_boolean',
- 'int_num',
- 'boolean_1'
- ]
+ '8ppj5gfrs': ['radius', 'boolean', 'num_boolean', 'int_num', 'boolean_1']
},
enabled: true
},
@@ -232,21 +219,23 @@ mergedLayer0.config = {
sizeField: null,
sizeDomain: [0, 1],
sizeScale: 'linear',
- textLabel: [{
- field: {
- name: 'name',
- type: 'string',
- format: '',
- id: 'name',
- tableFieldIndex: 8,
- analyzerType: 'STRING'
- },
- color: [184, 15, 135, 255],
- size: 27,
- offset: [-10, 0],
- anchor: 'end',
- alignment: 'center'
- }],
+ textLabel: [
+ {
+ field: {
+ name: 'name',
+ type: 'string',
+ format: '',
+ id: 'name',
+ tableFieldIndex: 8,
+ analyzerType: 'STRING'
+ },
+ color: [184, 15, 135, 255],
+ size: 27,
+ offset: [-10, 0],
+ anchor: 'end',
+ alignment: 'center'
+ }
+ ],
colorUI: {
color: DEFAULT_COLOR_UI,
colorRange: DEFAULT_COLOR_UI
@@ -261,28 +250,14 @@ mergedLayer0.config = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
filled: true,
strokeColorRange: {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
strokeColor: [23, 184, 190, 255],
radiusRange: [0, 50]
diff --git a/test/fixtures/state-saved-v1-5.js b/test/fixtures/state-saved-v1-5.js
index fb4e25ae8..d8544c961 100644
--- a/test/fixtures/state-saved-v1-5.js
+++ b/test/fixtures/state-saved-v1-5.js
@@ -180,14 +180,7 @@ export const savedStateV1TripGeoJson = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
trailLength: 180,
sizeRange: [0, 10]
diff --git a/test/fixtures/state-saved-v1-6.js b/test/fixtures/state-saved-v1-6.js
index c5db84fcd..46a05f5e1 100644
--- a/test/fixtures/state-saved-v1-6.js
+++ b/test/fixtures/state-saved-v1-6.js
@@ -711,14 +711,7 @@ export const savedStateWIthNonValidFilters = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radius: 10,
sizeRange: [18.9, 47.6],
diff --git a/test/fixtures/state-saved-v1-7.js b/test/fixtures/state-saved-v1-7.js
index 367b05e95..e444cd29b 100644
--- a/test/fixtures/state-saved-v1-7.js
+++ b/test/fixtures/state-saved-v1-7.js
@@ -711,14 +711,7 @@ export const savedStateV1InteractionCoordinate = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radius: 10,
sizeRange: [18.9, 47.6],
diff --git a/test/fixtures/test-csv-data.js b/test/fixtures/test-csv-data.js
index 5ab7af993..1eeee3dfe 100644
--- a/test/fixtures/test-csv-data.js
+++ b/test/fixtures/test-csv-data.js
@@ -95,14 +95,7 @@ export const config = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
radiusRange: [28.5, 194.7],
filled: true
@@ -153,14 +146,7 @@ export const config = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
coverage: 1,
sizeRange: [0, 500],
@@ -851,13 +837,13 @@ export const mergedEpochFilter = {
gpuChannel: [1]
};
-export const dateFilterProps ={
+export const dateFilterProps = {
domain: ['2016-09-23', '2016-09-24', '2016-10-10'],
fieldType: 'date',
type: 'multiSelect',
gpu: false,
value: []
-}
+};
export const mergedDateFilter = {
...dateFilterProps,
@@ -875,7 +861,7 @@ export const mergedDateFilter = {
plotType: 'histogram',
yAxis: null,
interval: null
-}
+};
export const wktCsvFields = [
{
@@ -923,7 +909,7 @@ export const wktCsvFields = [
];
export const wktCsvRows = [
- [ 7015, null, null, 7, 'C_Medium_High', 22.22 ],
+ [7015, null, null, 7, 'C_Medium_High', 22.22],
[
7014,
'{"type":"Polygon","coordinates":[[[-74.158491,40.835947],[-74.157914,40.83902],[-74.148473,40.834522]]]}',
diff --git a/test/fixtures/test-hex-id-data.js b/test/fixtures/test-hex-id-data.js
index 06e2cc6d6..63231c266 100644
--- a/test/fixtures/test-hex-id-data.js
+++ b/test/fixtures/test-hex-id-data.js
@@ -84,14 +84,7 @@ export const hexIdDataConfig = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
},
coverage: 1,
sizeRange: [0, 500],
diff --git a/test/fixtures/test-layer-data.js b/test/fixtures/test-layer-data.js
index c55cd8083..4ce428651 100644
--- a/test/fixtures/test-layer-data.js
+++ b/test/fixtures/test-layer-data.js
@@ -18,9 +18,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {getCentroid} from 'layers/h3-hexagon-layer/h3-utils';
-import {extent} from 'd3-array';
-
export default `utc_timestamp,lat,lng,lat_1,lng_1,types,has_result,id,hex_id,trip_distance,icon
Null,37.778564,-122.39096,37.769897,-122.41168,driver_analytics_0,FALSE,1,89283082c2fffff,1.59,accel
2016-09-17 00:10:56,37.78824,-122.40894,37.798237,-122.41889,null,FALSE,null,8928308288fffff,2.38,add-person
@@ -47,14 +44,9 @@ export const bounds = {
'lat-lng': [-122.42459, 37.40066, -122.10239, 38.281445],
'lat_1-lng_1': [-122.42929, 37.37006, -121.96353, 37.798237],
arc: [-122.42929, 37.37006, -121.96353, 38.281445],
- h3: [
- -122.42488652083654,
- 37.75385576067885,
- -122.42073136602062,
- 37.771654262080524
- ]
+ h3: [-122.42488652083654, 37.75385576067885, -122.42073136602062, 37.771654262080524]
};
export const fieldDomain = {
id: [1, 3, 4, 5, 34, 43, 222, 345]
-}
+};
diff --git a/test/fixtures/test-trip-data.js b/test/fixtures/test-trip-data.js
index a633baa84..54de3eb5a 100644
--- a/test/fixtures/test-trip-data.js
+++ b/test/fixtures/test-trip-data.js
@@ -172,14 +172,7 @@ export const config = {
name: 'Global Warming',
type: 'sequential',
category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
+ colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
}
}
},
@@ -262,222 +255,3 @@ export const config = {
}
}
};
-
-const exported = {
- version: 'v1',
- config: {
- visState: {
- layers: [
- {
- id: 'rsgg2rj',
- type: 'point',
- config: {
- dataId: 'test_trip_data',
- label: 'new layer',
- color: [221, 178, 124],
- columns: {
- lat: 'pickup_latitude',
- lng: 'pickup_longitude',
- altitude: null
- },
- isVisible: true,
- visConfig: {
- radius: 10,
- fixedRadius: false,
- opacity: 0.8,
- outline: false,
- thickness: 2,
- strokeColor: null,
- colorRange: {
- name: 'Ice And Fire 8',
- type: 'diverging',
- category: 'Uber',
- colors: [
- '#7F1941',
- '#D50255',
- '#FEAD54',
- '#FEEDB1',
- '#E8FEB5',
- '#49E3CE',
- '#0198BD',
- '#007A99'
- ],
- reversed: true
- },
- strokeColorRange: {
- name: 'Global Warming',
- type: 'sequential',
- category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
- },
- radiusRange: [0, 50],
- filled: true
- },
- textLabel: [
- {
- field: null,
- color: [255, 255, 255],
- size: 18,
- offset: [0, 0],
- anchor: 'start',
- alignment: 'center'
- }
- ]
- },
- visualChannels: {
- colorField: {
- name: 'trip_distance',
- type: 'real'
- },
- colorScale: 'quantile',
- strokeColorField: null,
- strokeColorScale: 'quantile',
- sizeField: {
- name: 'passenger_count',
- type: 'integer'
- },
- sizeScale: 'sqrt'
- }
- },
- {
- id: 'a9i93lg',
- type: 'arc',
- config: {
- dataId: 'test_trip_data',
- label: 'new layer',
- color: [136, 87, 44],
- columns: {
- lat0: 'pickup_latitude',
- lng0: 'pickup_longitude',
- lat1: 'dropoff_latitude',
- lng1: 'dropoff_longitude'
- },
- isVisible: true,
- visConfig: {
- opacity: 0.8,
- thickness: 2,
- colorRange: {
- name: 'Global Warming',
- type: 'sequential',
- category: 'Uber',
- colors: [
- '#5A1846',
- '#900C3F',
- '#C70039',
- '#E3611C',
- '#F1920E',
- '#FFC300'
- ]
- },
- sizeRange: [0, 10],
- targetColor: null
- },
- textLabel: [
- {
- field: null,
- color: [255, 255, 255],
- size: 18,
- offset: [0, 0],
- anchor: 'start',
- alignment: 'center'
- }
- ]
- },
- visualChannels: {
- colorField: null,
- colorScale: 'quantile',
- sizeField: null,
- sizeScale: 'linear'
- }
- },
- {
- id: '38f7j6',
- type: 'hexagon',
- config: {
- dataId: 'test_trip_data',
- label: 'new layer',
- color: [183, 136, 94],
- columns: {
- lat: 'pickup_latitude',
- lng: 'pickup_longitude'
- },
- isVisible: true,
- visConfig: {
- opacity: 0.76,
- worldUnitSize: 0.3,
- resolution: 8,
- colorRange: {
- name: 'ColorBrewer PuOr-10',
- type: 'diverging',
- category: 'ColorBrewer',
- colors: [
- '#7f3b08',
- '#b35806',
- '#e08214',
- '#fdb863',
- '#fee0b6',
- '#d8daeb',
- '#b2abd2',
- '#8073ac',
- '#542788',
- '#2d004b'
- ]
- },
- coverage: 1,
- sizeRange: [0, 500],
- percentile: [0, 100],
- elevationPercentile: [0, 100],
- elevationScale: 5,
- colorAggregation: 'count',
- sizeAggregation: 'count',
- enable3d: false
- },
- textLabel: [
- {
- field: null,
- color: [255, 255, 255],
- size: 18,
- offset: [0, 0],
- anchor: 'start',
- alignment: 'center'
- }
- ]
- },
- visualChannels: {
- colorField: null,
- colorScale: 'quantile',
- sizeField: null,
- sizeScale: 'linear'
- }
- }
- ],
- interactionConfig: {
- tooltip: {
- fieldsToShow: {
- test_trip_data: [
- 'tpep_pickup_datetime',
- 'tpep_dropoff_datetime',
- 'passenger_count',
- 'trip_distance',
- 'fare_amount'
- ]
- },
- enabled: true
- },
- brush: {
- size: 0.5,
- enabled: false
- }
- },
- layerBlending: 'normal',
- splitMaps: []
- }
- }
-};
diff --git a/test/fixtures/trip-geojson.js b/test/fixtures/trip-geojson.js
index 888dad6dd..6b99842ef 100644
--- a/test/fixtures/trip-geojson.js
+++ b/test/fixtures/trip-geojson.js
@@ -211,15 +211,27 @@ const tripGeoJson = {
const fts = tripGeoJson.features;
export const dataToFeature = [
- {type: 'Feature', properties: {...fts[0].properties, value: null, index: 0}, geometry: fts[0].geometry},
- {type: 'Feature', properties: {...fts[1].properties, types: null, index: 1}, geometry: fts[1].geometry},
+ {
+ type: 'Feature',
+ properties: {...fts[0].properties, value: null, index: 0},
+ geometry: fts[0].geometry
+ },
+ {
+ type: 'Feature',
+ properties: {...fts[1].properties, types: null, index: 1},
+ geometry: fts[1].geometry
+ },
{type: 'Feature', properties: {...fts[2].properties, index: 2}, geometry: fts[2].geometry},
{type: 'Feature', properties: {...fts[3].properties, index: 3}, geometry: fts[3].geometry},
{type: 'Feature', properties: {...fts[4].properties, index: 4}, geometry: fts[4].geometry},
{type: 'Feature', properties: {...fts[5].properties, index: 5}, geometry: fts[5].geometry},
{type: 'Feature', properties: {...fts[6].properties, index: 6}, geometry: fts[6].geometry},
{type: 'Feature', properties: {...fts[7].properties, index: 7}, geometry: fts[7].geometry},
- {type: 'Feature', properties: {...fts[8].properties, value: null, index: 8}, geometry: fts[8].geometry}
+ {
+ type: 'Feature',
+ properties: {...fts[8].properties, value: null, index: 8},
+ geometry: fts[8].geometry
+ }
];
export const dataToTimeStamp = [
diff --git a/test/helpers/comparison-utils.js b/test/helpers/comparison-utils.js
index a57fbcd26..e8ec14a7a 100644
--- a/test/helpers/comparison-utils.js
+++ b/test/helpers/comparison-utils.js
@@ -28,19 +28,8 @@ export function cmpObjectKeys(t, expectedObj, actualObj, name) {
);
}
-export function cmpFilters(
- t,
- expectedFilter,
- actualFilter,
- opt = {},
- idx = '',
- name = ''
-) {
- t.equal(
- typeof actualFilter,
- typeof expectedFilter,
- `${name}filters should be same type`
- );
+export function cmpFilters(t, expectedFilter, actualFilter, opt = {}, idx = '', name = '') {
+ t.equal(typeof actualFilter, typeof expectedFilter, `${name}filters should be same type`);
if (Array.isArray(expectedFilter) && Array.isArray(actualFilter)) {
t.equal(
actualFilter.length,
@@ -60,14 +49,8 @@ export function cmpFilters(
Object.keys(actualFilter).forEach(key => {
if (key === 'histogram' || key === 'enlargedHistogram') {
- if (
- actualFilter.type === FILTER_TYPES.range ||
- FILTER_TYPES.timeRange
- ) {
- t.ok(
- actualFilter[key].length,
- `${name}.filter.${key} should not be empty`
- );
+ if (actualFilter.type === FILTER_TYPES.range || FILTER_TYPES.timeRange) {
+ t.ok(actualFilter[key].length, `${name}.filter.${key} should not be empty`);
}
} else if (key !== 'id' || opt.id) {
// test everything except id, which is auto generated
@@ -82,28 +65,16 @@ export function cmpFilters(
}
export function cmpLayers(t, expectedLayer, actualLayer, opt = {}) {
- t.ok(
- actualLayer.constructor === expectedLayer.constructor,
- 'layer should be same class'
- );
+ t.ok(actualLayer.constructor === expectedLayer.constructor, 'layer should be same class');
// if is array of layers
if (Array.isArray(expectedLayer) && Array.isArray(actualLayer)) {
- t.equal(
- actualLayer.length,
- expectedLayer.length,
- 'should have same number of layers'
- );
+ t.equal(actualLayer.length, expectedLayer.length, 'should have same number of layers');
expectedLayer.forEach((_, i) => {
cmpLayers(t, expectedLayer[i], actualLayer[i]);
});
} else {
- cmpObjectKeys(
- t,
- expectedLayer.config,
- actualLayer.config,
- `layer.${actualLayer.id}`
- );
+ cmpObjectKeys(t, expectedLayer.config, actualLayer.config, `layer.${actualLayer.id}`);
Object.keys(expectedLayer.config).forEach(key => {
// test everything except color and id, which is auto generated
@@ -123,30 +94,15 @@ export function cmpLayers(t, expectedLayer, actualLayer, opt = {}) {
}
}
-export function cmpSavedLayers(
- t,
- expectedLayer,
- actualLayer,
- opt = {},
- idx = ''
-) {
+export function cmpSavedLayers(t, expectedLayer, actualLayer, opt = {}, idx = '') {
// if is array of layers
if (Array.isArray(expectedLayer) && Array.isArray(actualLayer)) {
- t.equal(
- actualLayer.length,
- expectedLayer.length,
- 'should have same number of layers'
- );
+ t.equal(actualLayer.length, expectedLayer.length, 'should have same number of layers');
expectedLayer.forEach((_, i) => {
cmpSavedLayers(t, expectedLayer[i], actualLayer[i], opt, i);
});
} else {
- cmpObjectKeys(
- t,
- expectedLayer,
- actualLayer,
- `idx:${idx} | layer.${actualLayer.type}`
- );
+ cmpObjectKeys(t, expectedLayer, actualLayer, `idx:${idx} | layer.${actualLayer.type}`);
t.deepEqual(
actualLayer,
@@ -190,12 +146,7 @@ export function cmpDatasets(t, expectedDatasets, actualDatasets) {
}
export function cmpDataset(t, expectedDataset, actualDataset, opt = {}) {
- cmpObjectKeys(
- t,
- expectedDataset,
- actualDataset,
- `dataset:${expectedDataset.id}`
- );
+ cmpObjectKeys(t, expectedDataset, actualDataset, `dataset:${expectedDataset.id}`);
// test everything except auto generated color
Object.keys(actualDataset).forEach(key => {
@@ -224,8 +175,10 @@ export function cmpDataset(t, expectedDataset, actualDataset, opt = {}) {
`dataset.${expectedDataset.id}.${key}`
);
Object.keys(expectedDataset[key]).forEach(item => {
- t.ok(Array.isArray(expectedDataset[key][item]),
- `dataset.${expectedDataset.id}[key].${item} should be an array`);
+ t.ok(
+ Array.isArray(expectedDataset[key][item]),
+ `dataset.${expectedDataset.id}[key].${item} should be an array`
+ );
// compare filter name
t.deepEqual(
actualDataset[key][item].map(f => f.name),
@@ -247,10 +200,7 @@ export function cmpGpuFilterProp(t, expectedGpuFilter, actualGpuFilter) {
cmpObjectKeys(t, expectedGpuFilter, actualGpuFilter, 'gpu filter');
Object.keys(expectedGpuFilter).forEach(key => {
- if (
- key === 'filterValueAccessor' &&
- expectedGpuFilter.filterValueAccessor.inputs
- ) {
+ if (key === 'filterValueAccessor' && expectedGpuFilter.filterValueAccessor.inputs) {
const {inputs, result} = expectedGpuFilter.filterValueAccessor;
t.deepEqual(
actualGpuFilter.filterValueAccessor()(...inputs),
@@ -260,11 +210,9 @@ export function cmpGpuFilterProp(t, expectedGpuFilter, actualGpuFilter) {
} else if (
key === 'filterValueAccessor' &&
typeof expectedGpuFilter.filterValueAccessor === 'function'
- ) {
-
+ ) {
// don't compare filter value accessor
return;
-
} else {
t.deepEqual(
actualGpuFilter[key],
@@ -291,31 +239,17 @@ export function cmpInteraction(t, expectedInt, actualInt) {
) {
cmpInteraction(t, expectedInt[key], actualInt[key]);
} else {
- t.deepEqual(
- actualInt[key],
- expectedInt[key],
- `interaction.${key} should be correct`
- );
+ t.deepEqual(actualInt[key], expectedInt[key], `interaction.${key} should be correct`);
}
});
}
-export function cmpParsedAppConfigs(
- t,
- expectedConfig,
- actualConfig,
- {name} = {}
-) {
+export function cmpParsedAppConfigs(t, expectedConfig, actualConfig, {name} = {}) {
t.deepEqual(actualConfig, expectedConfig, `${name} should be expected`);
Object.keys(actualConfig).forEach(key => {
if (key === 'visState') {
- cmpObjectKeys(
- t,
- expectedConfig.visState,
- actualConfig.visState,
- 'visState'
- );
+ cmpObjectKeys(t, expectedConfig.visState, actualConfig.visState, 'visState');
// for visConfig go through each entry
cmpParsedAppConfigs(t, expectedConfig[key], actualConfig[key], {
name: key
@@ -326,11 +260,7 @@ export function cmpParsedAppConfigs(
cmpFilters(t, expectedConfig[key], actualConfig[key], {id: true});
} else {
// for each reducer entry
- t.deepEqual(
- actualConfig[key],
- expectedConfig[key],
- `${key} should be correct`
- );
+ t.deepEqual(actualConfig[key], expectedConfig[key], `${key} should be correct`);
}
});
}
diff --git a/test/helpers/layer-utils.js b/test/helpers/layer-utils.js
index fba69a712..9c873c8f0 100644
--- a/test/helpers/layer-utils.js
+++ b/test/helpers/layer-utils.js
@@ -64,10 +64,7 @@ export function testCreateLayerFromConfig(t, tc) {
t.doesNotThrow(() => {
const {dataId} = layerConfig.config;
layer = validateLayerWithData(datasets[dataId], layerConfig, LayerClasses);
- t.ok(
- layer instanceof LayerClasses[layerConfig.type],
- `${layerConfig.type} layer created`
- );
+ t.ok(layer instanceof LayerClasses[layerConfig.type], `${layerConfig.type} layer created`);
layer.updateLayerDomain(datasets);
if (tc.afterLayerInitialized) {
tc.afterLayerInitialized(layer);
@@ -130,18 +127,11 @@ export function testFormatLayerDataCases(t, LayerClass, testCases) {
// if provided updates
if (layer && tc.updates) {
- const applyUpdates = Array.isArray(tc.updates)
- ? tc.updates
- : [tc.updates];
+ const applyUpdates = Array.isArray(tc.updates) ? tc.updates : [tc.updates];
// apply 1 or multiple updates
applyUpdates.forEach(update => {
- const updated = testUpdateLayer(
- t,
- updatedLayer,
- update.method,
- update.args
- );
+ const updated = testUpdateLayer(t, updatedLayer, update.method, update.args);
updatedLayer = updated.layer;
});
}
@@ -190,12 +180,7 @@ export function testRenderLayerCases(t, LayerClass, testCases) {
}
if (deckLayers) {
- const initialDeckLayers = testInitializeDeckLayer(
- t,
- layer.type,
- deckLayers,
- {viewport}
- );
+ const initialDeckLayers = testInitializeDeckLayer(t, layer.type, deckLayers, {viewport});
if (tc.assert) {
tc.assert(initialDeckLayers, layer, result);
@@ -215,19 +200,12 @@ export function testInitializeDeckLayer(t, layerType, deckLayers, {viewport}) {
const spy = sinon.spy(Console, 'error');
t.doesNotThrow(
- () =>
- layerManager.setLayers(
- Array.isArray(deckLayers) ? deckLayers : [deckLayers]
- ),
+ () => layerManager.setLayers(Array.isArray(deckLayers) ? deckLayers : [deckLayers]),
`initialization of ${layerType} layer render should not fail`
);
// listen on console.error in editShader, fail the test if any error is logged
- t.deepEqual(
- spy.args,
- [],
- 'should not call console.error during layer initialization'
- );
+ t.deepEqual(spy.args, [], 'should not call console.error during layer initialization');
spy.restore();
return layerManager.layers;
@@ -245,8 +223,7 @@ export function getNextColorMakerValue(num = 1) {
for (let n = 0; n < num; n++) {
const next = index + n + 1;
- const nextIndex =
- next < layerColors.length ? next : next - layerColors.length;
+ const nextIndex = next < layerColors.length ? next : next - layerColors.length;
results.push(layerColors[nextIndex]);
}
@@ -285,9 +262,7 @@ function addFilterToData(data, id, filters) {
}
export const {rows, fields} = processCsvData(csvData);
-export const {rows: testRows, fields: testFields} = processCsvData(
- testLayerData
-);
+export const {rows: testRows, fields: testFields} = processCsvData(testLayerData);
export const dataId = '0dj3h';
export {
@@ -299,9 +274,7 @@ export {
/*
* point, arc, hex, csv dataset from with gpu time filter
*/
-const timeFilter = [
- {name: 'utc_timestamp', value: [1474071095000, 1474071608000]}
-];
+const timeFilter = [{name: 'utc_timestamp', value: [1474071095000, 1474071608000]}];
const stateWithTimeFilter = addFilterToData(
{fields: testFields, rows: testRows},
@@ -321,7 +294,7 @@ export const arcLayerMeta = {
};
export const hexagonIdLayerMeta = {
bounds: bounds.h3
-}
+};
export {iconGeometry, fieldDomain};
/*
@@ -329,11 +302,9 @@ export {iconGeometry, fieldDomain};
*/
export const {rows: geoCsvRows, fields: geoCsvFields} = processCsvData(wktCsv);
-const stateWithGeoFilter = addFilterToData(
- {fields: geoCsvFields, rows: geoCsvRows},
- dataId,
- [{name: 'm_rate', value: [7, 10]}]
-);
+const stateWithGeoFilter = addFilterToData({fields: geoCsvFields, rows: geoCsvRows}, dataId, [
+ {name: 'm_rate', value: [7, 10]}
+]);
export const preparedGeoDataset = stateWithGeoFilter.datasets[dataId];
export const preparedGeoDatasetFilter = stateWithGeoFilter.filters[0];
@@ -341,15 +312,11 @@ export const preparedGeoDatasetFilter = stateWithGeoFilter.filters[0];
/*
* GeoJson dataset with gpu filter
*/
-export const {rows: geoJsonRows, fields: geoJsonFields} = processGeojson(
- cloneDeep(geojsonData)
-);
+export const {rows: geoJsonRows, fields: geoJsonFields} = processGeojson(cloneDeep(geojsonData));
-const stateWithGeojsonFilter = addFilterToData(
- {fields: geoJsonFields, rows: geoJsonRows},
- dataId,
- [{name: 'TRIPS', value: [4, 12]}]
-);
+const stateWithGeojsonFilter = addFilterToData({fields: geoJsonFields, rows: geoJsonRows}, dataId, [
+ {name: 'TRIPS', value: [4, 12]}
+]);
export const prepareGeojsonDataset = stateWithGeojsonFilter.datasets[dataId];
export const prepareGeojsonDatasetFilter = stateWithGeojsonFilter.filters[0];
@@ -359,9 +326,7 @@ export const geojsonFilterDomain0 = prepareGeojsonDatasetFilter.domain[0];
/*
* trip GeoJson dataset with gpu filter
*/
-export const {rows: tripGeoRows, fields: tripGeoFields} = processGeojson(
- cloneDeep(tripGeoJson)
-);
+export const {rows: tripGeoRows, fields: tripGeoFields} = processGeojson(cloneDeep(tripGeoJson));
const stateWithTripGeojsonFilter = addFilterToData(
{fields: tripGeoFields, rows: tripGeoRows},
diff --git a/test/helpers/mock-state.js b/test/helpers/mock-state.js
index 13b2dcac5..54f0f4aff 100644
--- a/test/helpers/mock-state.js
+++ b/test/helpers/mock-state.js
@@ -31,16 +31,8 @@ import {addDataToMap} from 'actions/actions';
import {DEFAULT_TEXT_LABEL, DEFAULT_COLOR_RANGE, DEFAULT_LAYER_OPACITY} from 'layers/layer-factory';
// fixtures
-import {
- dataId as csvDataId,
- testFields,
- testAllData
-} from 'test/fixtures/test-csv-data';
-import {
- fields,
- rows,
- geoJsonDataId
-} from 'test/fixtures/geojson';
+import {dataId as csvDataId, testFields, testAllData} from 'test/fixtures/test-csv-data';
+import {fields, rows, geoJsonDataId} from 'test/fixtures/geojson';
import {
fields as tripFields,
rows as tripRows,
@@ -75,8 +67,7 @@ export function applyActions(reducer, initialState, actions) {
const actionQ = Array.isArray(actions) ? actions : [actions];
return actionQ.reduce(
- (updatedState, {action, payload}) =>
- reducer(updatedState, action(...payload)),
+ (updatedState, {action, payload}) => reducer(updatedState, action(...payload)),
initialState
);
}
@@ -94,15 +85,11 @@ function mockStateWithFileUpload() {
const updatedState = applyActions(keplerGlReducer, initialState, [
{
action: VisStateActions.updateVisData,
- payload: [
- [{info: csvInfo, data: {fields: testFields, rows: testAllData}}]
- ]
+ payload: [[{info: csvInfo, data: {fields: testFields, rows: testAllData}}]]
},
{
action: VisStateActions.updateVisData,
- payload: [
- [{info: geojsonInfo, data: {fields: geojsonFields, rows: geojsonRows}}]
- ]
+ payload: [[{info: geojsonInfo, data: {fields: geojsonFields, rows: geojsonRows}}]]
}
]);
@@ -130,9 +117,7 @@ function mockStateWithTripGeojson() {
const updatedState = applyActions(keplerGlReducer, initialState, [
{
action: VisStateActions.updateVisData,
- payload: [
- [{info: tripDataInfo, data: processGeojson(cloneDeep(tripGeojson))}]
- ]
+ payload: [[{info: tripDataInfo, data: processGeojson(cloneDeep(tripGeojson))}]]
}
]);
@@ -214,7 +199,7 @@ function mockStateWithMultiFilters() {
{
action: VisStateActions.setFilter,
payload: [4, 'value', [1472700000000, 1472760000000]]
- },
+ }
]);
// replace filter id with controlled value for easy testing
@@ -232,16 +217,19 @@ function mockStateWithMultiFilters() {
function mockStateWithTripData() {
const initialState = cloneDeep(InitialState);
- return keplerGlReducer(initialState, addDataToMap({
- datasets: {
- info: {
- label: 'Sample Trips',
- id: tripDataId
+ return keplerGlReducer(
+ initialState,
+ addDataToMap({
+ datasets: {
+ info: {
+ label: 'Sample Trips',
+ id: tripDataId
+ },
+ data: {fields: tripFields, rows: tripRows}
},
- data: {fields: tripFields, rows: tripRows}
- },
- config: tripConfig
- }));
+ config: tripConfig
+ })
+ );
}
function mockStateWithLayerDimensions(state) {
@@ -263,9 +251,9 @@ function mockStateWithLayerDimensions(state) {
'color'
];
- const textLabelField = initialState.visState.datasets[
- testCsvDataId
- ].fields.find(f => f.name === 'date');
+ const textLabelField = initialState.visState.datasets[testCsvDataId].fields.find(
+ f => f.name === 'date'
+ );
const textLabelPayload1 = [layer0, 0, 'field', textLabelField];
const textLabelPayload2 = [layer0, 0, 'color', [255, 0, 0]];
@@ -649,9 +637,7 @@ export const expectedLoadedLayer2 = {
export const StateWFiles = mockStateWithFileUpload();
export const StateWFilters = mockStateWithFilters();
-export const StateWFilesFiltersLayerColor = mockStateWithLayerDimensions(
- StateWFilters
-);
+export const StateWFilesFiltersLayerColor = mockStateWithLayerDimensions(StateWFilters);
export const StateWMultiFilters = mockStateWithMultiFilters();
export const StateWCustomMapStyle = mockStateWithCustomMapStyle();
diff --git a/test/node/reducers/composer-state-test.js b/test/node/reducers/composer-state-test.js
index 0a0e32e4a..a39965730 100644
--- a/test/node/reducers/composer-state-test.js
+++ b/test/node/reducers/composer-state-test.js
@@ -33,12 +33,7 @@ import testHexIdData, {
mergedFilters,
expectedMergedDataset
} from 'test/fixtures/test-hex-id-data';
-import {
- cmpLayers,
- cmpFilters,
- cmpDataset,
- cmpInteraction
-} from 'test/helpers/comparison-utils';
+import {cmpLayers, cmpFilters, cmpDataset, cmpInteraction} from 'test/helpers/comparison-utils';
import {INITIAL_UI_STATE} from 'reducers/ui-state-updaters';
const mockRawData = {
@@ -122,16 +117,8 @@ test('#composerStateReducer - addDataToMapUpdater: mapState should be centered',
}
});
- t.equal(
- newState.mapState.latitude,
- 29.23,
- 'centerMap: true should override mapState config'
- );
- t.equal(
- newState.mapState.longitude,
- 60.71,
- 'centerMap: true should override mapState config'
- );
+ t.equal(newState.mapState.latitude, 29.23, 'centerMap: true should override mapState config');
+ t.equal(newState.mapState.longitude, 60.71, 'centerMap: true should override mapState config');
t.end();
});
@@ -209,7 +196,7 @@ test('#composerStateReducer - addDataToMapUpdater: keepExistingConfig', t => {
}
});
- cmpDataset(t, expectedMergedDataset, nextState1.visState.datasets[hexDataId])
+ cmpDataset(t, expectedMergedDataset, nextState1.visState.datasets[hexDataId]);
t.deepEqual(nextState1.visState.splitMaps, [], 'should clear out splitMaps');
@@ -270,15 +257,24 @@ test('#composerStateReducer - addDataToMapUpdater: keepExistingConfig', t => {
cmpLayers(t, expectedVisState.layers, actualVisState.layers);
cmpFilters(t, expectedVisState.filters, actualVisState.filters);
// test datasets
- t.deepEqual(Object.keys(actualVisState.datasets), [sampleConfig.dataId, hexDataId], 'should save 2 datasets to state');
- t.equal(actualVisState.datasets[sampleConfig.dataId], oldDatasets[sampleConfig.dataId], 'should keep oldDataset same');
+ t.deepEqual(
+ Object.keys(actualVisState.datasets),
+ [sampleConfig.dataId, hexDataId],
+ 'should save 2 datasets to state'
+ );
+ t.equal(
+ actualVisState.datasets[sampleConfig.dataId],
+ oldDatasets[sampleConfig.dataId],
+ 'should keep oldDataset same'
+ );
- cmpDataset(t, expectedMergedDataset, actualVisState.datasets[hexDataId], 'should merge and filter hexdata');
- cmpInteraction(
+ cmpDataset(
t,
- expectedVisState.interactionConfig,
- actualVisState.interactionConfig
+ expectedMergedDataset,
+ actualVisState.datasets[hexDataId],
+ 'should merge and filter hexdata'
);
+ cmpInteraction(t, expectedVisState.interactionConfig, actualVisState.interactionConfig);
t.deepEqual(
expectedVisState.layerOrder,
actualVisState.layerOrder,
@@ -318,11 +314,7 @@ test('#composerStateReducer - addDataToMapUpdater: readOnly', t => {
datasets
}
});
- t.equal(
- nextState1.uiState.readOnly,
- false,
- 'should set readonly to be false'
- );
+ t.equal(nextState1.uiState.readOnly, false, 'should set readonly to be false');
const nextState2 = addDataToMapUpdater(state, {
payload: {
@@ -332,10 +324,6 @@ test('#composerStateReducer - addDataToMapUpdater: readOnly', t => {
}
}
});
- t.equal(
- nextState2.uiState.readOnly,
- false,
- 'should set readonly to be false'
- );
+ t.equal(nextState2.uiState.readOnly, false, 'should set readonly to be false');
t.end();
});
diff --git a/test/node/reducers/map-state-test.js b/test/node/reducers/map-state-test.js
index 6d3d8acfb..341359048 100644
--- a/test/node/reducers/map-state-test.js
+++ b/test/node/reducers/map-state-test.js
@@ -20,12 +20,7 @@
import test from 'tape';
-import {
- updateMap,
- togglePerspective,
- fitBounds,
- toggleSplitMap
-} from 'actions/map-state-actions';
+import {updateMap, togglePerspective, fitBounds, toggleSplitMap} from 'actions/map-state-actions';
import {receiveMapConfig} from 'actions/actions';
@@ -36,7 +31,11 @@ const InitialMapState = reducer(undefined, {});
test('#mapStateReducer', t => {
const newState = reducer(undefined, {});
- t.deepEqual(newState, {...INITIAL_MAP_STATE, initialState: {}}, 'should return the initial state');
+ t.deepEqual(
+ newState,
+ {...INITIAL_MAP_STATE, initialState: {}},
+ 'should return the initial state'
+ );
t.end();
});
@@ -45,7 +44,11 @@ test('#mapStateReducerFactory', t => {
const mapStateReducer = mapStateReducerFactory({dragRotate: true});
const newState = mapStateReducer(undefined, {});
- t.deepEqual(newState, {...INITIAL_MAP_STATE, dragRotate: true, initialState: {dragRotate: true}}, 'should return the initial state');
+ t.deepEqual(
+ newState,
+ {...INITIAL_MAP_STATE, dragRotate: true, initialState: {dragRotate: true}},
+ 'should return the initial state'
+ );
t.end();
});
@@ -60,11 +63,7 @@ test('#mapStateReducer -> UPDATE_MAP', t => {
const newState = reducer(undefined, updateMap(mapUpdate));
- t.deepEqual(
- newState,
- expectedState,
- 'should update map longitude and latitude'
- );
+ t.deepEqual(newState, expectedState, 'should update map longitude and latitude');
t.end();
});
@@ -74,20 +73,12 @@ test('#mapStateReducer -> TOGGLE_PERSPECTIVE', t => {
t.equal(newState.dragRotate, false, 'dragRotate should default to false');
const newState2 = reducer(undefined, togglePerspective());
- t.equal(
- newState2.dragRotate,
- true,
- 'dragRotate toggle should set it to true'
- );
+ t.equal(newState2.dragRotate, true, 'dragRotate toggle should set it to true');
t.equal(newState2.pitch, 50, 'pitch should set to default');
t.equal(newState2.bearing, 24, 'bearing should set to default');
const newState3 = reducer(newState2, togglePerspective());
- t.equal(
- newState3.dragRotate,
- false,
- 'dragRotate 2nd toggle should set it to false'
- );
+ t.equal(newState3.dragRotate, false, 'dragRotate 2nd toggle should set it to false');
t.equal(newState3.pitch, 0, 'pitch should set to zero');
t.equal(newState3.bearing, 0, 'bearing should set to zero');
@@ -98,12 +89,7 @@ test('#mapStateReducer -> FIT_BOUNDS', t => {
// default input and output in @mapbox/geo-viewport
// https://github.com/mapbox/geo-viewport
- const bounds = [
- 5.668343999999995,
- 45.111511000000014,
- 5.852471999999996,
- 45.26800200000002
- ];
+ const bounds = [5.668343999999995, 45.111511000000014, 5.852471999999996, 45.26800200000002];
const mapUpdate = {
width: 640,
@@ -139,11 +125,7 @@ test('#mapStateReducer -> SPLIT_MAP: toggle', t => {
// go back to single view
newState = reducer(newState, toggleSplitMap());
- t.deepEqual(
- newState,
- INITIAL_MAP_STATE,
- 'should validate toggle back from split view'
- );
+ t.deepEqual(newState, INITIAL_MAP_STATE, 'should validate toggle back from split view');
t.end();
});
@@ -217,7 +199,6 @@ test('#mapStateReducer -> SPLIT_MAP: upload mapState config to update split map
);
t.end();
-
});
test('#mapStateReducer -> SPLIT_MAP: close map at specific point', t => {
@@ -234,11 +215,7 @@ test('#mapStateReducer -> SPLIT_MAP: close map at specific point', t => {
// go back to single view
newState = reducer(newState, toggleSplitMap(1));
- t.deepEqual(
- newState,
- INITIAL_MAP_STATE,
- 'should validate toggle back from split view'
- );
+ t.deepEqual(newState, INITIAL_MAP_STATE, 'should validate toggle back from split view');
t.end();
});
diff --git a/test/node/reducers/map-style-test.js b/test/node/reducers/map-style-test.js
index 570535048..111527100 100644
--- a/test/node/reducers/map-style-test.js
+++ b/test/node/reducers/map-style-test.js
@@ -22,7 +22,11 @@ import test from 'tape';
import {drainTasksForTesting, succeedTaskWithValues} from 'react-palm/tasks';
import reducer from 'reducers/map-style';
-import {INITIAL_MAP_STYLE, loadMapStylesUpdater, getInitialInputStyle} from 'reducers/map-style-updaters';
+import {
+ INITIAL_MAP_STYLE,
+ loadMapStylesUpdater,
+ getInitialInputStyle
+} from 'reducers/map-style-updaters';
import {keplerGlInit, receiveMapConfig} from 'actions/actions';
import SchemaManager from 'schemas';
import {DEFAULT_MAP_STYLES, DEFAULT_MAPBOX_API_URL} from 'constants/default-settings';
@@ -71,10 +75,10 @@ test('#mapStyleReducer -> INIT', t => {
test('#mapStyleReducer -> INIT & LOAD_MAP_STYLES', t => {
const myMapStyle = {
- id : 'default dark v9',
- label : 'default dark v9',
- url : 'mapbox://styles/mapbox/dark-v9',
- icon : `images/light.png`,
+ id: 'default dark v9',
+ label: 'default dark v9',
+ url: 'mapbox://styles/mapbox/dark-v9',
+ icon: `images/light.png`,
layerGroups: []
};
const newState = reducer(
@@ -102,7 +106,7 @@ test('#mapStyleReducer -> INIT & LOAD_MAP_STYLES', t => {
[myMapStyle.id]: myMapStyle
};
- const finalState = loadMapStylesUpdater(newState, { payload: mapStyles });
+ const finalState = loadMapStylesUpdater(newState, {payload: mapStyles});
t.deepEqual(
finalState,
@@ -127,10 +131,7 @@ test('#mapStyleReducer -> RECEIVE_MAP_CONFIG', t => {
// load state
const stateLoaded = SchemaManager.parseSavedConfig(savedState);
- const stateWithConfig = reducer(
- stateWithToken,
- receiveMapConfig(stateLoaded)
- );
+ const stateWithConfig = reducer(stateWithToken, receiveMapConfig(stateLoaded));
const defaultMapStyles = DEFAULT_MAP_STYLES.reduce(
(accu, st) => ({
@@ -148,7 +149,8 @@ test('#mapStyleReducer -> RECEIVE_MAP_CONFIG', t => {
smoothie_the_cat: {
accessToken: 'secret_token',
custom: true,
- icon: 'https://api.mapbox.com/styles/v1/shanhe/smoothie.the.cat/static/-122.3391,37.7922,9,0,0/400x300?access_token=secret_token&logo=false&attribution=false',
+ icon:
+ 'https://api.mapbox.com/styles/v1/shanhe/smoothie.the.cat/static/-122.3391,37.7922,9,0,0/400x300?access_token=secret_token&logo=false&attribution=false',
id: 'smoothie_the_cat',
label: 'Smoothie the Cat',
url: 'mapbox://styles/shanhe/smoothie.the.cat'
@@ -164,11 +166,7 @@ test('#mapStyleReducer -> RECEIVE_MAP_CONFIG', t => {
initialState: {}
};
- t.deepEqual(
- stateWithConfig,
- expectedStateWithConfig,
- 'should load saved map style config'
- );
+ t.deepEqual(stateWithConfig, expectedStateWithConfig, 'should load saved map style config');
const [task1, ...more] = drainTasksForTesting();
@@ -184,11 +182,7 @@ test('#mapStyleReducer -> RECEIVE_MAP_CONFIG', t => {
]
};
- t.deepEqual(
- task1.payload,
- expectedTask.payload,
- 'should create task to load map styles'
- );
+ t.deepEqual(task1.payload, expectedTask.payload, 'should create task to load map styles');
const resultState1 = reducer(
stateWithConfig,
@@ -201,7 +195,8 @@ test('#mapStyleReducer -> RECEIVE_MAP_CONFIG', t => {
smoothie_the_cat: {
accessToken: 'secret_token',
custom: true,
- icon: 'https://api.mapbox.com/styles/v1/shanhe/smoothie.the.cat/static/-122.3391,37.7922,9,0,0/400x300?access_token=secret_token&logo=false&attribution=false',
+ icon:
+ 'https://api.mapbox.com/styles/v1/shanhe/smoothie.the.cat/static/-122.3391,37.7922,9,0,0/400x300?access_token=secret_token&logo=false&attribution=false',
id: 'smoothie_the_cat',
label: 'Smoothie the Cat',
url: 'mapbox://styles/shanhe/smoothie.the.cat',
diff --git a/test/node/reducers/provider-state-test.js b/test/node/reducers/provider-state-test.js
index 2f257e1da..33e1b0be8 100644
--- a/test/node/reducers/provider-state-test.js
+++ b/test/node/reducers/provider-state-test.js
@@ -20,20 +20,12 @@
import test from 'tape';
import React from 'react';
-import {
- drainTasksForTesting,
- succeedTaskInTest,
- errorTaskInTest
-} from 'react-palm/tasks';
+import {drainTasksForTesting, succeedTaskInTest, errorTaskInTest} from 'react-palm/tasks';
import sinon from 'sinon';
import {default as Console} from 'global/console';
import ActionTypes from 'constants/action-types';
-import {
- exportFileToCloud,
- resetProviderStatus,
- setCloudProvider
-} from 'actions/provider-actions';
+import {exportFileToCloud, resetProviderStatus, setCloudProvider} from 'actions/provider-actions';
import reducer, {providerStateReducerFactory} from 'reducers/provider-state';
import {INITIAL_PROVIDER_STATE} from 'reducers/provider-state-updaters';
@@ -105,16 +97,10 @@ test('#providerStateReducer -> EXPORT_FILE_TO_CLOUD', t => {
'provider is not defined',
'should warn when cannot find kepler.gl state'
);
- reducer(
- undefined,
- exportFileToCloud({provider: {name: 'taro', hello: true}})
- );
+ reducer(undefined, exportFileToCloud({provider: {name: 'taro', hello: true}}));
// uploadFile
- t.ok(
- errSpy.calledTwice,
- 'should call console.error if provider does not have uploadFile'
- );
+ t.ok(errSpy.calledTwice, 'should call console.error if provider does not have uploadFile');
t.equal(
errSpy.getCall(1).args[0],
'uploadFile is not a function of Cloud provider: taro',
@@ -147,11 +133,7 @@ test('#providerStateReducer -> EXPORT_FILE_TO_CLOUD', t => {
'Should set isLoading and current provider'
);
- t.equal(
- task1.type,
- 'EXPORT_FILE_TO_CLOUD_TASK',
- 'should create export file tasks'
- );
+ t.equal(task1.type, 'EXPORT_FILE_TO_CLOUD_TASK', 'should create export file tasks');
t.deepEqual(
task1.payload,
{
@@ -167,10 +149,7 @@ test('#providerStateReducer -> EXPORT_FILE_TO_CLOUD', t => {
);
// success
- const resultState1 = reducer(
- nextState,
- succeedTaskInTest(task1, {url: 'taro_and_blue'})
- );
+ const resultState1 = reducer(nextState, succeedTaskInTest(task1, {url: 'taro_and_blue'}));
t.deepEqual(
resultState1,
@@ -187,10 +166,7 @@ test('#providerStateReducer -> EXPORT_FILE_TO_CLOUD', t => {
t.ok(task2.length === 0, 'should create 0 task');
// error
- const resultState2 = reducer(
- nextState,
- errorTaskInTest(task1, new Error('hello'))
- );
+ const resultState2 = reducer(nextState, errorTaskInTest(task1, new Error('hello')));
t.deepEqual(
resultState2,
{
@@ -259,11 +235,7 @@ test('#providerStateReducer -> EXPORT_FILE_TO_CLOUD -> onSuccess : onError', t =
);
const [task1, ...more] = drainTasksForTesting();
t.ok(more.length === 0, 'should create 1 task');
- t.equal(
- task1.type,
- 'EXPORT_FILE_TO_CLOUD_TASK',
- 'should create export file tasks'
- );
+ t.equal(task1.type, 'EXPORT_FILE_TO_CLOUD_TASK', 'should create export file tasks');
// success
const nextState = reducer(state, succeedTaskInTest(task1, mockResponse));
@@ -285,10 +257,7 @@ test('#providerStateReducer -> EXPORT_FILE_TO_CLOUD -> onSuccess : onError', t =
);
const resultState1 = reducer(nextState, succeedTaskInTest(task2, undefined));
- const resultState2 = reducer(
- resultState1,
- succeedTaskInTest(task3, undefined)
- );
+ const resultState2 = reducer(resultState1, succeedTaskInTest(task3, undefined));
// saveToCloudSuccess
const [task4, task5, task6, ...more3] = drainTasksForTesting();
@@ -313,7 +282,11 @@ test('#providerStateReducer -> EXPORT_FILE_TO_CLOUD -> onSuccess : onError', t =
'Should call toggleModal(null'
);
const resultState4 = composedReducer(resultState3, succeedTaskInTest(task5, undefined));
- t.equal(resultState4.notification.type, 'success', 'Should call addNotification with successNote');
+ t.equal(
+ resultState4.notification.type,
+ 'success',
+ 'Should call addNotification with successNote'
+ );
const resultState5 = composedReducer(resultState4, succeedTaskInTest(task6, undefined));
t.equal(resultState5.remove, true, 'Should call removeNotification');
@@ -346,7 +319,7 @@ test('#providerStateReducer -> RESET_PROVIDER_STATUS', t => {
);
t.end();
-})
+});
test('#providerStateReducer -> SET_CLOUD_PROVIDER', t => {
const nextState = reducer(undefined, setCloudProvider('blue'));
diff --git a/test/node/reducers/root-test.js b/test/node/reducers/root-test.js
index a70c6addb..962938521 100644
--- a/test/node/reducers/root-test.js
+++ b/test/node/reducers/root-test.js
@@ -20,26 +20,46 @@
import test from 'tape';
import keplerGlReducer from 'reducers';
-import {registerEntry, resetMapConfig, receiveMapConfig, toggleSplitMap, toggleMapControl} from 'actions';
+import {
+ registerEntry,
+ resetMapConfig,
+ receiveMapConfig,
+ toggleSplitMap,
+ toggleMapControl
+} from 'actions';
import {createAction, handleActions} from 'redux-actions';
test('keplerGlReducer.initialState', t => {
-
- const test1Reducer = keplerGlReducer
- .initialState({
- visState: {
- layerClasses: []
- },
- mapStyle: {
- styleType: 'light'
- }
- });
+ const test1Reducer = keplerGlReducer.initialState({
+ visState: {
+ layerClasses: []
+ },
+ mapStyle: {
+ styleType: 'light'
+ }
+ });
const test1ReducerInitialState = test1Reducer(undefined, registerEntry({id: 'test'}));
- t.deepEqual(test1ReducerInitialState.test.visState.layerClasses, [], 'should override initialState');
- t.equal(test1ReducerInitialState.test.mapStyle.styleType, 'light', 'should override initialState');
- t.deepEqual(test1ReducerInitialState.test.visState.initialState, {layerClasses: []}, 'should save initialState');
- t.deepEqual(test1ReducerInitialState.test.mapStyle.initialState, {styleType: 'light'}, 'should save initialState');
+ t.deepEqual(
+ test1ReducerInitialState.test.visState.layerClasses,
+ [],
+ 'should override initialState'
+ );
+ t.equal(
+ test1ReducerInitialState.test.mapStyle.styleType,
+ 'light',
+ 'should override initialState'
+ );
+ t.deepEqual(
+ test1ReducerInitialState.test.visState.initialState,
+ {layerClasses: []},
+ 'should save initialState'
+ );
+ t.deepEqual(
+ test1ReducerInitialState.test.mapStyle.initialState,
+ {styleType: 'light'},
+ 'should save initialState'
+ );
// change it
const newConfig = {
@@ -50,21 +70,32 @@ test('keplerGlReducer.initialState', t => {
const modifiedReducer = test1Reducer(test1ReducerInitialState, receiveMapConfig(newConfig));
t.deepEqual(modifiedReducer.test.visState.layerBlending, 'additive', 'should apply config');
t.equal(modifiedReducer.test.mapStyle.styleType, 'beautiful', 'should apply config');
- t.deepEqual(modifiedReducer.test.visState.initialState, {layerClasses: []}, 'should save initialState');
+ t.deepEqual(
+ modifiedReducer.test.visState.initialState,
+ {layerClasses: []},
+ 'should save initialState'
+ );
// reset reducer
const restTestReducer = test1Reducer(modifiedReducer, resetMapConfig());
t.deepEqual(restTestReducer.test.visState.layerClasses, [], 'should override initialState');
t.equal(restTestReducer.test.mapStyle.styleType, 'light', 'should override initialState');
- t.deepEqual(restTestReducer.test.visState.initialState, {layerClasses: []}, 'should save initialState');
- t.deepEqual(restTestReducer.test.mapStyle.initialState, {styleType: 'light'}, 'should save initialState');
+ t.deepEqual(
+ restTestReducer.test.visState.initialState,
+ {layerClasses: []},
+ 'should save initialState'
+ );
+ t.deepEqual(
+ restTestReducer.test.mapStyle.initialState,
+ {styleType: 'light'},
+ 'should save initialState'
+ );
t.end();
});
test('keplerGlReducer.initialState.2', t => {
- const test1Reducer = keplerGlReducer
- .initialState({
+ const test1Reducer = keplerGlReducer.initialState({
visState: {
layerClasses: []
},
@@ -86,7 +117,11 @@ test('keplerGlReducer.initialState.2', t => {
const test2InitialState = test2Reducer(undefined, registerEntry({id: 'test2'}));
- t.deepEqual(test2InitialState.test2.visState.layerClasses, [], 'should keep previous initialState');
+ t.deepEqual(
+ test2InitialState.test2.visState.layerClasses,
+ [],
+ 'should keep previous initialState'
+ );
t.equal(test2InitialState.test2.mapStyle.styleType, 'smoothie', 'should overide initialState');
t.equal(test2InitialState.test2.mapStyle.hello, 'kitty', 'should provide initialState');
t.equal(test2InitialState.test2.mapState.dragRotate, true, 'should provide initialState');
@@ -101,15 +136,27 @@ test('keplerGlReducer.initialState.2', t => {
t.deepEqual(modifiedReducer2.test2.visState.layerBlending, 'subtractive', 'should apply config');
t.equal(modifiedReducer2.test2.mapStyle.styleType, 'earth', 'should apply config');
- t.deepEqual(modifiedReducer2.test2.visState.initialState, {layerClasses: []}, 'should save initialState');
+ t.deepEqual(
+ modifiedReducer2.test2.visState.initialState,
+ {layerClasses: []},
+ 'should save initialState'
+ );
// reset reducer
const restTestReducer2 = test2Reducer(modifiedReducer2, resetMapConfig());
t.deepEqual(restTestReducer2.test2.visState.layerClasses, [], 'should reset initialState');
t.equal(restTestReducer2.test2.mapStyle.styleType, 'smoothie', 'should reset initialState');
t.equal(restTestReducer2.test2.mapState.dragRotate, true, 'should reset initialState');
- t.deepEqual(restTestReducer2.test2.visState.initialState, {layerClasses: []}, 'should save initialState');
- t.deepEqual(restTestReducer2.test2.mapStyle.initialState, {styleType: 'smoothie', hello: 'kitty'}, 'should save initialState');
+ t.deepEqual(
+ restTestReducer2.test2.visState.initialState,
+ {layerClasses: []},
+ 'should save initialState'
+ );
+ t.deepEqual(
+ restTestReducer2.test2.mapStyle.initialState,
+ {styleType: 'smoothie', hello: 'kitty'},
+ 'should save initialState'
+ );
t.end();
});
@@ -138,26 +185,31 @@ test('keplerGlReducer.plugin', t => {
// plugin 2 actions
const testReducer = keplerGlReducer
- // 1. as reducer map
- .plugin({
- 'HIDE_AND_SHOW_SIDE_PANEL': (state, action) => ({
- ...state,
- uiState: {
- ...state.uiState,
- readOnly: !state.uiState.readOnly
- }
- }),
- })
- .plugin(handleActions({
- // 2. as reducer
- 'HIDE_MAP_CONTROLS': (state, action) => ({
- ...state,
- uiState: {
- ...state.uiState,
- mapControls: hiddenMapControl
- }
+ // 1. as reducer map
+ .plugin({
+ HIDE_AND_SHOW_SIDE_PANEL: (state, action) => ({
+ ...state,
+ uiState: {
+ ...state.uiState,
+ readOnly: !state.uiState.readOnly
+ }
+ })
})
- }, {}));
+ .plugin(
+ handleActions(
+ {
+ // 2. as reducer
+ HIDE_MAP_CONTROLS: (state, action) => ({
+ ...state,
+ uiState: {
+ ...state.uiState,
+ mapControls: hiddenMapControl
+ }
+ })
+ },
+ {}
+ )
+ );
const testInitialState = testReducer(undefined, registerEntry({id: 'test3'}));
const previousValue = testInitialState.test3.uiState.readOnly;
@@ -179,11 +231,7 @@ test('keplerGlReducer - splitMap and mapControl interaction', t => {
state = keplerGlReducer(state, toggleMapControl('mapDraw'));
- t.equal(
- state.test.uiState.mapControls.mapDraw.active,
- true,
- 'Map draw should now be active'
- );
+ t.equal(state.test.uiState.mapControls.mapDraw.active, true, 'Map draw should now be active');
t.equal(
state.test.uiState.mapControls.mapDraw.activeMapIndex,
@@ -201,11 +249,7 @@ test('keplerGlReducer - splitMap and mapControl interaction', t => {
state = keplerGlReducer(state, toggleSplitMap());
- t.equal(
- state.test.mapState.isSplit,
- true,
- 'Should have split map'
- );
+ t.equal(state.test.mapState.isSplit, true, 'Should have split map');
state = keplerGlReducer(state, toggleMapControl('mapDraw', 1));
diff --git a/test/node/reducers/ui-state-test.js b/test/node/reducers/ui-state-test.js
index 03878d8b6..b9f8707e7 100644
--- a/test/node/reducers/ui-state-test.js
+++ b/test/node/reducers/ui-state-test.js
@@ -102,11 +102,7 @@ test('#uiStateReducer -> OPEN_DELETE_MODAL', t => {
datasetKeyToRemove: 'chai'
};
- t.deepEqual(
- newReducer,
- expectedState,
- 'should open delete data modal and save key to remove'
- );
+ t.deepEqual(newReducer, expectedState, 'should open delete data modal and save key to remove');
t.end();
});
@@ -167,10 +163,7 @@ test('#uiStateReducer -> SET_EXPORT_SELECTED_DATASET', t => {
});
test('#uiStateReducer -> SET_EXPORT_DATA_TYPE', t => {
- const newReducer = reducer(
- INITIAL_UI_STATE,
- setExportDataType(EXPORT_DATA_TYPE.JSON)
- );
+ const newReducer = reducer(INITIAL_UI_STATE, setExportDataType(EXPORT_DATA_TYPE.JSON));
const expectedState = {
...INITIAL_UI_STATE,
@@ -212,11 +205,7 @@ test('#uiStateReducer -> ADD_NOTIFICATION', t => {
})
);
- t.equal(
- newState.notifications.length,
- 1,
- 'AddNotification should add one new notification'
- );
+ t.equal(newState.notifications.length, 1, 'AddNotification should add one new notification');
t.deepEqual(
newState.notifications[0],
{
@@ -242,11 +231,7 @@ test('#uiStateReducer -> REMOVE_NOTIFICATION', t => {
})
);
- t.equal(
- newState.notifications.length,
- 1,
- 'AddNotification should add one new notification'
- );
+ t.equal(newState.notifications.length, 1, 'AddNotification should add one new notification');
t.deepEqual(
newState.notifications[0],
{
@@ -260,28 +245,17 @@ test('#uiStateReducer -> REMOVE_NOTIFICATION', t => {
const nextState = reducer(newState, removeNotification('test-1'));
- t.equal(
- nextState.notifications.length,
- 0,
- 'RemoveNotification removed one notification'
- );
+ t.equal(nextState.notifications.length, 0, 'RemoveNotification removed one notification');
t.end();
});
test('#uiStateReducer -> LOAD_FILES_ERR', t => {
const newState = reducer(INITIAL_UI_STATE, loadFiles());
- t.equal(
- newState.loadFiles.fileLoading,
- true,
- 'should set fileLoading to true'
- );
+ t.equal(newState.loadFiles.fileLoading, true, 'should set fileLoading to true');
- const newState1 = reducer(
- newState,
- loadFilesErr(new Error('this is an error'))
- );
- const expectedId = newState1.notifications.length ? newState1.notifications[0].id : 'error'
+ const newState1 = reducer(newState, loadFilesErr(new Error('this is an error')));
+ const expectedId = newState1.notifications.length ? newState1.notifications[0].id : 'error';
t.equal(
newState1.loadFiles.fileLoading,
false,
@@ -289,12 +263,14 @@ test('#uiStateReducer -> LOAD_FILES_ERR', t => {
);
t.deepEqual(
newState1.notifications,
- [{
- type: 'error',
- topic: 'global',
- message: 'this is an error',
- id: expectedId
- }],
+ [
+ {
+ type: 'error',
+ topic: 'global',
+ message: 'this is an error',
+ id: expectedId
+ }
+ ],
'should add an error notification'
);
diff --git a/test/node/reducers/vis-state-merger-test.js b/test/node/reducers/vis-state-merger-test.js
index cfaefe9ca..562629d78 100644
--- a/test/node/reducers/vis-state-merger-test.js
+++ b/test/node/reducers/vis-state-merger-test.js
@@ -49,7 +49,7 @@ import {
savedStateV1,
mergedFilters as mergedFiltersV1,
mergedLayers as mergedLayersV1,
- mergedInteraction as MergedInteractionV1,
+ mergedInteraction as MergedInteractionV1
} from 'test/fixtures/state-saved-v1-1';
import {
@@ -68,13 +68,9 @@ import {
mergedLayer0 as mergedTripLayer
} from 'test/fixtures/state-saved-v1-5';
-import {
- savedStateV1InteractionCoordinate
-} from 'test/fixtures/state-saved-v1-7';
+import {savedStateV1InteractionCoordinate} from 'test/fixtures/state-saved-v1-7';
-import {
- savedStateWIthNonValidFilters as NonValidFilterState
-} from 'test/fixtures/state-saved-v1-6';
+import {savedStateWIthNonValidFilters as NonValidFilterState} from 'test/fixtures/state-saved-v1-6';
import {polygonFilterMap} from 'test/fixtures/polygon-filter-map';
@@ -117,10 +113,7 @@ test('VisStateMerger.v0 -> mergeFilters -> toEmptyState', t => {
const oldState = cloneDeep(InitialState);
const oldVisState = oldState.visState;
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedFilters = parsedConfig.visState.filters;
const mergedState = mergeFilters(oldState.visState, parsedFilters);
@@ -132,11 +125,7 @@ test('VisStateMerger.v0 -> mergeFilters -> toEmptyState', t => {
'Should save filters to filterToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -157,10 +146,7 @@ test('VisStateMerger.v1 -> mergeFilters -> toEmptyState', t => {
const oldVisState = oldState.visState;
const expectedMergedFilterV1 = mergedFiltersV1;
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedFilters = parsedConfig.visState.filters;
const mergedState = mergeFilters(oldState.visState, parsedFilters);
@@ -172,11 +158,7 @@ test('VisStateMerger.v1 -> mergeFilters -> toEmptyState', t => {
'Should save filters to filterToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -197,10 +179,7 @@ test('VisStateMerger.v0 -> mergeFilters -> toWorkingState', t => {
const oldVisState = oldState.visState;
const oldFilters = [...oldState.visState.filters];
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedFilters = parsedConfig.visState.filters;
const mergedState = mergeFilters(oldState.visState, parsedFilters);
@@ -213,11 +192,7 @@ test('VisStateMerger.v0 -> mergeFilters -> toWorkingState', t => {
'Should save filters to filterToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -228,11 +203,7 @@ test('VisStateMerger.v0 -> mergeFilters -> toWorkingState', t => {
// test parsed filters
cmpFilters(t, [...oldFilters, ...mergedFiltersV0], stateWData.filters);
- t.deepEqual(
- stateWData.filterToBeMerged,
- [],
- 'should clear up filterToBeMerged'
- );
+ t.deepEqual(stateWData.filterToBeMerged, [], 'should clear up filterToBeMerged');
// should filter data
t.end();
@@ -245,10 +216,7 @@ test('VisStateMerger.v1 -> mergeFilters -> toWorkingState', t => {
const oldVisState = oldState.visState;
const oldFilters = [...oldState.visState.filters];
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedFilters = parsedConfig.visState.filters;
const mergedState = mergeFilters(oldState.visState, parsedFilters);
@@ -261,11 +229,7 @@ test('VisStateMerger.v1 -> mergeFilters -> toWorkingState', t => {
'Should save filters to filterToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -276,11 +240,7 @@ test('VisStateMerger.v1 -> mergeFilters -> toWorkingState', t => {
// test parsed filters
cmpFilters(t, [...oldFilters, ...mergedFiltersV1], stateWData.filters);
- t.deepEqual(
- stateWData.filterToBeMerged,
- [],
- 'should clear up filterToBeMerged'
- );
+ t.deepEqual(stateWData.filterToBeMerged, [], 'should clear up filterToBeMerged');
// should filter data
t.end();
@@ -308,11 +268,7 @@ test('VisStateMerger.current -> mergeLayers -> toEmptyState', t => {
'Should save layers to layerToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
const parsedData = SchemaManager.parseSavedData(appStateToSave.datasets);
@@ -349,11 +305,7 @@ test('VisStateMerger.v1 -> mergeLayers -> toEmptyState', t => {
'Should save layers to layerToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
const parsedData = SchemaManager.parseSavedData(savedStateV1.datasets);
@@ -386,11 +338,7 @@ test('VisStateMerger.v1.label -> mergeLayers -> toEmptyState', t => {
'Should save layers to layerToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
const parsedData = SchemaManager.parseSavedData(savedStateV1Label.datasets);
@@ -414,10 +362,7 @@ test('VisStateMerger.v1.split -> mergeLayers -> toEmptyState', t => {
const parsedLayers = parsedConfig.visState.layers;
// merge State
- const mergedState = visStateReducer(
- oldVisState,
- receiveMapConfig(parsedConfig)
- );
+ const mergedState = visStateReducer(oldVisState, receiveMapConfig(parsedConfig));
Object.keys(oldVisState).forEach(key => {
if (key === 'layerToBeMerged') {
t.deepEqual(
@@ -426,11 +371,7 @@ test('VisStateMerger.v1.split -> mergeLayers -> toEmptyState', t => {
'Should save layers to layerToBeMerged before data loaded'
);
} else if (key === 'splitMaps') {
- t.deepEqual(
- mergedState.splitMaps,
- [],
- 'Should wait to merge splitMaps'
- );
+ t.deepEqual(mergedState.splitMaps, [], 'Should wait to merge splitMaps');
} else if (key === 'splitMaps') {
t.deepEqual(
mergedState.splitMapsToBeMerged,
@@ -444,11 +385,7 @@ test('VisStateMerger.v1.split -> mergeLayers -> toEmptyState', t => {
'Should save interactionConfig to interactionToBeMerged'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- `Should keep ${key} the same`
- );
+ t.deepEqual(mergedState[key], oldVisState[key], `Should keep ${key} the same`);
}
});
@@ -486,11 +423,7 @@ test('VisStateMerger.v0 -> mergeLayers -> toWorkingState', t => {
'Should save layers to layerToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -507,11 +440,7 @@ test('VisStateMerger.v0 -> mergeLayers -> toWorkingState', t => {
[3, 4, 5, 6, 7, 2, 0, 1],
'should put new layers on top of old ones'
);
- t.deepEqual(
- stateWData.layerToBeMerged,
- [],
- 'should clean up layer to be merged'
- );
+ t.deepEqual(stateWData.layerToBeMerged, [], 'should clean up layer to be merged');
t.equal(stateWData.layerData.length, 8, 'should calculate layer data');
t.end();
@@ -538,11 +467,7 @@ test('VisStateMerger.v1 -> mergeLayers -> toWorkingState', t => {
'Should save layers to layerToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -554,16 +479,8 @@ test('VisStateMerger.v1 -> mergeLayers -> toWorkingState', t => {
// test parsed filters
cmpLayers(t, [...oldLayers, ...mergedLayersV1], stateWData.layers);
- t.deepEqual(
- stateWData.layerOrder,
- [3, 4, 2, 0, 1],
- 'should put new layers on top of old ones'
- );
- t.deepEqual(
- stateWData.layerToBeMerged,
- [],
- 'should clean up layer to be merged'
- );
+ t.deepEqual(stateWData.layerOrder, [3, 4, 2, 0, 1], 'should put new layers on top of old ones');
+ t.deepEqual(stateWData.layerToBeMerged, [], 'should clean up layer to be merged');
t.equal(stateWData.layerData.length, 5, 'should calculate layer data');
t.end();
@@ -574,10 +491,7 @@ test('VisStateMerger.v0 -> mergeInteractions -> toEmptyState', t => {
const oldState = cloneDeep(InitialState);
const oldVisState = oldState.visState;
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedInteraction = parsedConfig.visState.interactionConfig;
// merge interactions
@@ -605,11 +519,7 @@ test('VisStateMerger.v0 -> mergeInteractions -> toEmptyState', t => {
'Should disable interaction: null'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -619,11 +529,7 @@ test('VisStateMerger.v0 -> mergeInteractions -> toEmptyState', t => {
const stateWData = visStateReducer(mergedState, updateVisData(parsedData));
// test parsed interactions
- t.deepEqual(
- stateWData.interactionConfig,
- mergedInteractionsV0,
- 'should merge interactionConfig'
- );
+ t.deepEqual(stateWData.interactionConfig, mergedInteractionsV0, 'should merge interactionConfig');
t.deepEqual(stateWData.interactionToBeMerged, {}, 'should clear interaction');
t.end();
@@ -644,10 +550,7 @@ test('VisStateMerger.v0 -> mergeInteractions -> toWorkingState', t => {
}
};
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedInteraction = parsedConfig.visState.interactionConfig;
@@ -672,11 +575,7 @@ test('VisStateMerger.v0 -> mergeInteractions -> toWorkingState', t => {
'Should save interactions to interactionToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -709,11 +608,7 @@ test('VisStateMerger.v0 -> mergeInteractions -> toWorkingState', t => {
};
// test parsed interactions
- t.deepEqual(
- stateWData.interactionConfig,
- expectedInteractions,
- 'should merge interactionconfig'
- );
+ t.deepEqual(stateWData.interactionConfig, expectedInteractions, 'should merge interactionconfig');
t.deepEqual(stateWData.interactionToBeMerged, {}, 'should clear interaction');
t.end();
@@ -724,10 +619,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> toEmptyState', t => {
const oldState = cloneDeep(InitialState);
const oldVisState = oldState.visState;
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedInteraction = parsedConfig.visState.interactionConfig;
// merge interactions
@@ -771,11 +663,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> toEmptyState', t => {
'Should disable tooltip'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -785,11 +673,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> toEmptyState', t => {
const stateWData = visStateReducer(mergedState, updateVisData(parsedData));
// test parsed interactions
- t.deepEqual(
- stateWData.interactionConfig,
- MergedInteractionV1,
- 'should merge interactionConfig'
- );
+ t.deepEqual(stateWData.interactionConfig, MergedInteractionV1, 'should merge interactionConfig');
t.deepEqual(stateWData.interactionToBeMerged, {}, 'should clear interaction');
t.end();
@@ -810,10 +694,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> toWorkingState', t => {
}
};
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedInteraction = parsedConfig.visState.interactionConfig;
@@ -875,11 +756,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> toWorkingState', t => {
'Should disable interaction: null'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -915,11 +792,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> toWorkingState', t => {
};
// test parsed interactions
- t.deepEqual(
- stateWData.interactionConfig,
- expectedInteractions,
- 'should merge interactionConfig'
- );
+ t.deepEqual(stateWData.interactionConfig, expectedInteractions, 'should merge interactionConfig');
t.deepEqual(stateWData.interactionToBeMerged, {}, 'should clear interaction');
t.end();
@@ -930,10 +803,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> coordinate', t => {
const oldState = cloneDeep(InitialState);
const oldVisState = oldState.visState;
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedInteraction = parsedConfig.visState.interactionConfig;
@@ -976,11 +846,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> coordinate', t => {
'Should disable interaction: null'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -1012,11 +878,7 @@ test('VisStateMerger.v1 -> mergeInteractions -> coordinate', t => {
};
// test parsed interactions
- t.deepEqual(
- stateWData.interactionConfig,
- expectedInteractions,
- 'should merge interactionConfig'
- );
+ t.deepEqual(stateWData.interactionConfig, expectedInteractions, 'should merge interactionConfig');
t.deepEqual(stateWData.interactionToBeMerged, {}, 'should clear interaction');
@@ -1103,11 +965,7 @@ test('VisStateMerger - mergeSplitMaps -> split to split', t => {
oldState,
receiveMapConfig(parsedConfig, {keepExistingConfig: true})
);
- t.deepEqual(
- mergedState2.splitMaps,
- oldState.splitMaps,
- 'Should keep current splitMaps'
- );
+ t.deepEqual(mergedState2.splitMaps, oldState.splitMaps, 'Should keep current splitMaps');
t.deepEqual(
mergedState2.splitMapsToBeMerged,
expectedToMerge,
@@ -1118,16 +976,8 @@ test('VisStateMerger - mergeSplitMaps -> split to split', t => {
// 3. load data into reducer
const mergedState3 = visStateReducer(mergedState2, updateVisData(parsedData));
- t.deepEqual(
- mergedState3.splitMaps,
- expectedToMergeAll,
- 'Should merge all splitMaps'
- );
- t.deepEqual(
- mergedState3.splitMapsToBeMerged,
- [],
- 'Should empty splitMapsToBeMerged'
- );
+ t.deepEqual(mergedState3.splitMaps, expectedToMergeAll, 'Should merge all splitMaps');
+ t.deepEqual(mergedState3.splitMapsToBeMerged, [], 'Should empty splitMapsToBeMerged');
t.end();
});
@@ -1182,7 +1032,11 @@ test('VisStateMerger - mergeSplitMaps', t => {
);
const testState4 = {
- layers: [{id: 'a', config: {isVisible: true}}, {id: 'b', config: {isVisible: false}}, {id: 'c', config: {isVisible: true}}],
+ layers: [
+ {id: 'a', config: {isVisible: true}},
+ {id: 'b', config: {isVisible: false}},
+ {id: 'c', config: {isVisible: true}}
+ ],
splitMaps: []
};
t.deepEqual(
@@ -1202,7 +1056,7 @@ test('VisStateMerger - mergeTripGeojson', t => {
const initialState = cloneDeep(InitialState);
// processKeplerglJSON
- const result = processKeplerglJSON(savedStateV1TripGeoJson)
+ const result = processKeplerglJSON(savedStateV1TripGeoJson);
const updatedCore = coreReducer(initialState, addDataToMap(result));
const mergedVieState = updatedCore.visState;
@@ -1226,11 +1080,7 @@ test('VisStateMerger - mergeTripGeojson', t => {
'dataToTimeStamp should be correct'
);
- t.deepEqual(
- tripLayer.meta.bounds,
- mergedTripLayer.meta.bounds,
- 'meta.bounds should be correct'
- );
+ t.deepEqual(tripLayer.meta.bounds, mergedTripLayer.meta.bounds, 'meta.bounds should be correct');
t.deepEqual(
tripLayer.meta.featureTypes,
@@ -1246,10 +1096,7 @@ test('VisStateMerger.v1 -> mergeFilters -> nonValidFilter', t => {
const oldState = cloneDeep(InitialState);
const oldVisState = oldState.visState;
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedFilters = parsedConfig.visState.filters;
const mergedState = mergeFilters(oldState.visState, parsedFilters);
@@ -1262,11 +1109,7 @@ test('VisStateMerger.v1 -> mergeFilters -> nonValidFilter', t => {
'Should save filters to filterToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
@@ -1280,7 +1123,6 @@ test('VisStateMerger.v1 -> mergeFilters -> nonValidFilter', t => {
t.end();
});
-
test('VisStateMerger.v1 -> mergeFilters -> multiFilters', t => {
const stateToSave = cloneDeep(StateWMultiFilters);
const oldCsvData = stateToSave.visState.datasets[testCsvDataId];
@@ -1291,30 +1133,51 @@ test('VisStateMerger.v1 -> mergeFilters -> multiFilters', t => {
const oldState = cloneDeep(InitialState);
const oldVisState = oldState.visState;
- const mergedState = visStateReducer(oldVisState,
- updateVisData(
- stateParsed.datasets,
- {},
- stateParsed.config
- ));
+ const mergedState = visStateReducer(
+ oldVisState,
+ updateVisData(stateParsed.datasets, {}, stateParsed.config)
+ );
// check datasets is filtered
// and field has filterProps
const expectedDatasets = {
[testCsvDataId]: {
fields: datasetCsvFields.map(f => ({
...f,
- ...(
- f.name === 'time' ?
- {filterProps: timeFilterProps} :
- f.name === 'date' ?
- {filterProps: dateFilterProps} :
- f.name === 'epoch' ?
- {filterProps: epochFilterProps} :
- {}
- )
+ ...(f.name === 'time'
+ ? {filterProps: timeFilterProps}
+ : f.name === 'date'
+ ? {filterProps: dateFilterProps}
+ : f.name === 'epoch'
+ ? {filterProps: epochFilterProps}
+ : {})
})),
allData: testAllData,
- allIndexes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
+ allIndexes: [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23
+ ],
id: testCsvDataId,
label: 'hello.csv',
color: 'donot test me',
@@ -1341,26 +1204,24 @@ test('VisStateMerger.v1 -> mergeFilters -> multiFilters', t => {
gpuFilter_3: null
},
filterValueAccessor: {
- inputs: [{
- data: testAllData[1],
- index: 1
- }],
- result: [
- 1474588800000 - 1474588800000,
- 1472688000000 - 1472688000000,
- 0,0
- ]
+ inputs: [
+ {
+ data: testAllData[1],
+ index: 1
+ }
+ ],
+ result: [1474588800000 - 1474588800000, 1472688000000 - 1472688000000, 0, 0]
}
}
},
[testGeoJsonDataId]: {
fields: testGeoJsonFields.map(f => ({
...f,
- ...(
- f.name === 'TRIPS' ?
- {filterProps: geoJsonTripFilterProps} : f.name === 'RATE' ?
- {filterProps: geoJsonRateFilterProps} : {}
- )
+ ...(f.name === 'TRIPS'
+ ? {filterProps: geoJsonTripFilterProps}
+ : f.name === 'RATE'
+ ? {filterProps: geoJsonRateFilterProps}
+ : {})
})),
filterRecord: {
dynamicDomain: [mergedRateFilter, mergedTripFilter],
@@ -1382,10 +1243,12 @@ test('VisStateMerger.v1 -> mergeFilters -> multiFilters', t => {
gpuFilter_3: null
},
filterValueAccessor: {
- inputs: [{
- data: testGeoJsonAllData[1],
- index: 1
- }],
+ inputs: [
+ {
+ data: testGeoJsonAllData[1],
+ index: 1
+ }
+ ],
result: [0, 0, 0, 0]
}
},
@@ -1419,10 +1282,7 @@ test('VisStateMerger -> import polygon filter map', t => {
const savedConfig = cloneDeep(polygonFilterMap);
const oldVisState = oldState.visState;
- const parsedConfig = SchemaManager.parseSavedConfig(
- savedConfig.config,
- oldState
- );
+ const parsedConfig = SchemaManager.parseSavedConfig(savedConfig.config, oldState);
const parsedFilters = parsedConfig.visState.filters;
@@ -1436,11 +1296,7 @@ test('VisStateMerger -> import polygon filter map', t => {
'Should save filters to filterToBeMerged before data loaded'
);
} else {
- t.deepEqual(
- mergedState[key],
- oldVisState[key],
- 'Should keep the rest of state same'
- );
+ t.deepEqual(mergedState[key], oldVisState[key], 'Should keep the rest of state same');
}
});
diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.js
index 0b67b91d6..29bb19ba1 100644
--- a/test/node/reducers/vis-state-test.js
+++ b/test/node/reducers/vis-state-test.js
@@ -373,21 +373,13 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.2', t => {
['driver_analytics', 'driver_analytics_0', 'driver_gps'],
'should calculate color domain'
);
- t.equal(
- newLayer.config.visConfig.colorRange,
- mockColorRange,
- 'should update color range'
- );
+ t.equal(newLayer.config.visConfig.colorRange, mockColorRange, 'should update color range');
// set point layer sizeField to a int field
const intField = testFields.find(f => f.type === 'integer');
let nextState2 = reducer(
nextState,
- VisStateActions.layerVisualChannelConfigChange(
- newLayer,
- {sizeField: intField},
- 'size'
- )
+ VisStateActions.layerVisualChannelConfigChange(newLayer, {sizeField: intField}, 'size')
);
nextState2 = reducer(
nextState2,
@@ -398,22 +390,11 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.2', t => {
const newLayer2 = nextState2.layers[0];
t.equal(newLayer2.config.sizeField, intField, 'should update sizeField');
t.equal(newLayer2.config.sizeScale, 'sqrt', 'should scale to sqrt');
- t.deepEqual(
- newLayer2.config.sizeDomain,
- [1, 12124],
- 'should calculate size domain'
- );
- t.deepEqual(
- newLayer2.config.visConfig.radiusRange,
- [5, 10],
- 'should update size range'
- );
+ t.deepEqual(newLayer2.config.sizeDomain, [1, 12124], 'should calculate size domain');
+ t.deepEqual(newLayer2.config.visConfig.radiusRange, [5, 10], 'should update size range');
// change point layer type to hexagon
- const nextState3 = reducer(
- nextState2,
- VisStateActions.layerTypeChange(newLayer2, 'hexagon')
- );
+ const nextState3 = reducer(nextState2, VisStateActions.layerTypeChange(newLayer2, 'hexagon'));
const newLayer3 = nextState3.layers[0];
t.equal(newLayer3.type, 'hexagon', 'should change type to hexagon');
@@ -423,28 +404,12 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.2', t => {
[0, 1],
'should set colorDomain to default, it is calculated inside deck.gl layer'
);
- t.equal(
- newLayer3.config.colorScale,
- 'ordinal',
- 'should set colorScale to ordinal'
- );
- t.equal(
- newLayer3.config.sizeScale,
- 'sqrt',
- 'should set sizeScale to default'
- );
- t.deepEqual(
- newLayer3.config.sizeDomain,
- [0, 1],
- 'should set sizeDomain to default'
- );
+ t.equal(newLayer3.config.colorScale, 'ordinal', 'should set colorScale to ordinal');
+ t.equal(newLayer3.config.sizeScale, 'sqrt', 'should set sizeScale to default');
+ t.deepEqual(newLayer3.config.sizeDomain, [0, 1], 'should set sizeDomain to default');
t.equal(newLayer3.config.sizeField, intField, 'should keep sizeField');
t.notEqual(newLayer3.id, newLayer2.id, 'should change id');
- t.equal(
- newLayer3.config.visConfig.colorRange,
- mockColorRange,
- 'should not deep copy colorRange'
- );
+ t.equal(newLayer3.config.visConfig.colorRange, mockColorRange, 'should not deep copy colorRange');
t.equal(
newLayer3.config.visConfig.sizeRange,
LAYER_VIS_CONFIGS.elevationRange.defaultValue,
@@ -452,10 +417,7 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.2', t => {
);
// change point layer type to icon
- const nextState4 = reducer(
- nextState2,
- VisStateActions.layerTypeChange(newLayer2, 'icon')
- );
+ const nextState4 = reducer(nextState2, VisStateActions.layerTypeChange(newLayer2, 'icon'));
const newLayer4 = nextState4.layers[0];
t.equal(newLayer4.type, 'icon', 'should change type to icon');
t.notEqual(newLayer4.id, newLayer2.id, 'should change id');
@@ -468,21 +430,9 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.2', t => {
t.equal(newLayer4.config.colorScale, 'ordinal', 'should keep color scale');
t.equal(newLayer4.config.sizeField, intField, 'should keep sizeField');
t.equal(newLayer4.config.sizeScale, 'sqrt', 'should scale to linear');
- t.deepEqual(
- newLayer4.config.sizeDomain,
- [1, 12124],
- 'should keep size domain'
- );
- t.deepEqual(
- newLayer4.config.visConfig.radiusRange,
- [5, 10],
- 'should keep size range'
- );
- t.equal(
- newLayer4.config.visConfig.colorRange,
- mockColorRange,
- 'should not deep copy colorRange'
- );
+ t.deepEqual(newLayer4.config.sizeDomain, [1, 12124], 'should keep size domain');
+ t.deepEqual(newLayer4.config.visConfig.radiusRange, [5, 10], 'should keep size range');
+ t.equal(newLayer4.config.visConfig.colorRange, mockColorRange, 'should not deep copy colorRange');
t.end();
});
@@ -510,10 +460,7 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.3 -> animationConfig', t => {
};
// change GeoJson layer to Trip layer
- const nextState = reducer(
- oldState,
- VisStateActions.layerTypeChange(layer, 'trip')
- );
+ const nextState = reducer(oldState, VisStateActions.layerTypeChange(layer, 'trip'));
const foundLayer = nextState.layers[0];
const foundLayerId = foundLayer.id;
@@ -536,10 +483,7 @@ test('#visStateReducer -> LAYER_TYPE_CHANGE.3 -> animationConfig', t => {
);
// change Trip layer to Geojson layer
- const nextState2 = reducer(
- oldState,
- VisStateActions.layerTypeChange(foundLayer, 'geojson')
- );
+ const nextState2 = reducer(oldState, VisStateActions.layerTypeChange(foundLayer, 'geojson'));
const foundLayer2 = nextState2.layers[0];
t.ok(foundLayer2.id !== foundLayerId, 'should update layer id');
t.equal(foundLayer2.type, 'geojson', 'should update type to trip');
@@ -601,36 +545,17 @@ test('#visStateReducer -> LAYER_CONFIG_CHANGE -> isVisible -> splitMaps', t => {
{layers: {'point-0': false, 'geojson-1': true}},
{layers: {'point-0': true, 'geojson-1': true}}
];
- const expectedSplitMaps = [
- {layers: {'geojson-1': true}},
- {layers: {'geojson-1': true}}
- ];
- t.deepEqual(
- initialState.splitMaps,
- initialSplitMaps,
- 'should has the same initial splitMaps'
- );
+ const expectedSplitMaps = [{layers: {'geojson-1': true}}, {layers: {'geojson-1': true}}];
+ t.deepEqual(initialState.splitMaps, initialSplitMaps, 'should has the same initial splitMaps');
const nextState = reducer(
initialState,
VisStateActions.layerConfigChange(layer, {isVisible: false})
);
- t.equal(
- nextState.layers[0].config.isVisible,
- false,
- 'should set layer 0 visibility to false'
- );
- t.equal(
- initialState.layerData[0],
- nextState.layerData[0],
- 'should not update layerData'
- );
- t.deepEqual(
- nextState.splitMaps,
- expectedSplitMaps,
- 'should remove layer from splitMaps'
- );
+ t.equal(nextState.layers[0].config.isVisible, false, 'should set layer 0 visibility to false');
+ t.equal(initialState.layerData[0], nextState.layerData[0], 'should not update layerData');
+ t.deepEqual(nextState.splitMaps, expectedSplitMaps, 'should remove layer from splitMaps');
const nextState2 = reducer(
nextState,
@@ -641,11 +566,7 @@ test('#visStateReducer -> LAYER_CONFIG_CHANGE -> isVisible -> splitMaps', t => {
{layers: {'point-0': true, 'geojson-1': true}},
{layers: {'point-0': true, 'geojson-1': true}}
];
- t.deepEqual(
- nextState2.splitMaps,
- initialSplitMaps2,
- 'should add layer to splitMaps'
- );
+ t.deepEqual(nextState2.splitMaps, initialSplitMaps2, 'should add layer to splitMaps');
t.end();
});
@@ -659,11 +580,7 @@ test('#visStateReducer -> LAYER_VIS_CONFIG_CHANGE -> opacity', t => {
VisStateActions.layerVisConfigChange(layer, {opacity: 0.3})
);
- t.equal(
- nextState.layers[0].config.visConfig.opacity,
- 0.3,
- 'should update layer opacity'
- );
+ t.equal(nextState.layers[0].config.visConfig.opacity, 0.3, 'should update layer opacity');
t.end();
});
@@ -672,11 +589,7 @@ test('#visStateReducer -> LAYER_TEXT_LABEL_CHANGE', t => {
// point layer
const layer = initialState.layers[0];
- t.deepEqual(
- layer.config.textLabel,
- [DEFAULT_TEXT_LABEL],
- 'should set initial textLabel'
- );
+ t.deepEqual(layer.config.textLabel, [DEFAULT_TEXT_LABEL], 'should set initial textLabel');
const nextState = reducer(
initialState,
@@ -691,12 +604,7 @@ test('#visStateReducer -> LAYER_TEXT_LABEL_CHANGE', t => {
const nextState2 = reducer(
nextState,
- VisStateActions.layerTextLabelChange(
- nextState.layers[0],
- 0,
- 'anchor',
- 'start'
- )
+ VisStateActions.layerTextLabelChange(nextState.layers[0], 0, 'anchor', 'start')
);
t.deepEqual(
@@ -739,22 +647,13 @@ test('#visStateReducer -> LAYER_TEXT_LABEL_CHANGE', t => {
// add or remove labels
const nextState5 = reducer(
nextState4,
- VisStateActions.layerTextLabelChange(
- nextState4.layers[0],
- 'all',
- 'fields',
- [{name: 'blue'}, {name: 'taro'}]
- )
- );
- const expected5 = [
- expectedTextLabel1,
- {...DEFAULT_TEXT_LABEL, field: {name: 'blue'}}
- ];
- t.deepEqual(
- nextState5.layers[0].config.textLabel,
- expected5,
- 'should add text label taro'
+ VisStateActions.layerTextLabelChange(nextState4.layers[0], 'all', 'fields', [
+ {name: 'blue'},
+ {name: 'taro'}
+ ])
);
+ const expected5 = [expectedTextLabel1, {...DEFAULT_TEXT_LABEL, field: {name: 'blue'}}];
+ t.deepEqual(nextState5.layers[0].config.textLabel, expected5, 'should add text label taro');
// add 1 more label
const nextState6 = reducer(
@@ -768,43 +667,23 @@ test('#visStateReducer -> LAYER_TEXT_LABEL_CHANGE', t => {
{...DEFAULT_TEXT_LABEL, field: {name: 'blue'}},
{...DEFAULT_TEXT_LABEL, field: {name: 'cat'}}
];
- t.deepEqual(
- nextState6.layers[0].config.textLabel,
- expected6,
- 'should add text label cat'
- );
+ t.deepEqual(nextState6.layers[0].config.textLabel, expected6, 'should add text label cat');
// remove label
const nextState7 = reducer(
nextState6,
VisStateActions.layerTextLabelChange(nextState6.layers[0], 2, 'field', null)
);
- const expected7 = [
- expectedTextLabel1,
- {...DEFAULT_TEXT_LABEL, field: {name: 'blue'}}
- ];
- t.deepEqual(
- nextState7.layers[0].config.textLabel,
- expected7,
- 'should remove text label cat'
- );
+ const expected7 = [expectedTextLabel1, {...DEFAULT_TEXT_LABEL, field: {name: 'blue'}}];
+ t.deepEqual(nextState7.layers[0].config.textLabel, expected7, 'should remove text label cat');
// remove label with all
const nextState8 = reducer(
nextState7,
- VisStateActions.layerTextLabelChange(
- nextState7.layers[0],
- 'all',
- 'fields',
- [{name: 'blue'}]
- )
+ VisStateActions.layerTextLabelChange(nextState7.layers[0], 'all', 'fields', [{name: 'blue'}])
);
const expected8 = [{...DEFAULT_TEXT_LABEL, field: {name: 'blue'}}];
- t.deepEqual(
- nextState8.layers[0].config.textLabel,
- expected8,
- 'should remove text label blue'
- );
+ t.deepEqual(nextState8.layers[0].config.textLabel, expected8, 'should remove text label blue');
t.end();
});
@@ -815,11 +694,7 @@ test('#visStateReducer -> REORDER_LAYER', t => {
VisStateActions.reorderLayer([0, 2, 1])
);
- t.deepEqual(
- newReducer,
- {layers: [], layerOrder: [0, 2, 1]},
- 'should re order layers'
- );
+ t.deepEqual(newReducer, {layers: [], layerOrder: [0, 2, 1]}, 'should re order layers');
t.end();
});
@@ -830,11 +705,7 @@ test('#visStateReducer -> UPDATE_LAYER_BLENDING', t => {
VisStateActions.updateLayerBlending('additive')
);
- t.deepEqual(
- newReducer,
- {layerBlending: 'additive'},
- 'should update layerBlending'
- );
+ t.deepEqual(newReducer, {layerBlending: 'additive'}, 'should update layerBlending');
t.end();
});
@@ -905,10 +776,7 @@ test('#visStateReducer -> REMOVE_FILTER', t => {
[testCsvDataId]: expectedData0,
[testGeoJsonDataId]: expectedData1
},
- layerData: [
- initialState.layerData[0],
- expectedLayerData1
- ]
+ layerData: [initialState.layerData[0], expectedLayerData1]
};
cmpObjectKeys(t, expectedState, newReducer, 'After removing filter, visState');
@@ -941,7 +809,11 @@ test('#visStateReducer -> REMOVE_FILTER', t => {
});
break;
default:
- t.deepEqual(newReducer[key], expectedState[key], `visState.${key} should be correct after removing filter`);
+ t.deepEqual(
+ newReducer[key],
+ expectedState[key],
+ `visState.${key} should be correct after removing filter`
+ );
break;
}
});
@@ -999,10 +871,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.1 -> No data', t => {
};
t.deepEqual(
- reducer(
- oldState,
- VisStateActions.updateVisData([{info: null, data: null}])
- ),
+ reducer(oldState, VisStateActions.updateVisData([{info: null, data: null}])),
oldState,
'should return current state if no data'
);
@@ -1066,7 +935,12 @@ test('#visStateReducer -> UPDATE_VIS_DATA.2 -> to empty state', t => {
allIndexes: mockRawData.rows.map((_, i) => i),
allData: mockRawData.rows,
gpuFilter: {
- filterRange: [[0, 0], [0, 0], [0, 0], [0, 0]],
+ filterRange: [
+ [0, 0],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
filterValueUpdateTriggers: {
gpuFilter_0: null,
gpuFilter_1: null,
@@ -1171,20 +1045,12 @@ test('#visStateReducer -> UPDATE_VIS_DATA.2 -> to empty state', t => {
expectedArcLayer,
expectedLineLayer
];
- t.deepEqual(
- Object.keys(newState.datasets),
- ['smoothie'],
- 'should save data to smoothie'
- );
+ t.deepEqual(Object.keys(newState.datasets), ['smoothie'], 'should save data to smoothie');
cmpDatasets(t, expectedDatasets, newState.datasets);
cmpLayers(t, expectedLayers, newStateLayers);
- t.equal(
- newState.layerData.length,
- expectedLayers.length,
- 'should calculate layerdata'
- );
+ t.equal(newState.layerData.length, expectedLayers.length, 'should calculate layerdata');
t.deepEqual(newState.layerOrder, [0, 1, 2, 3], 'should calculate layerOrder');
t.end();
@@ -1208,7 +1074,12 @@ test('#visStateReducer -> UPDATE_VIS_DATA.3 -> merge w/ existing state', t => {
const oldState = {
...INITIAL_VIS_STATE,
layers: [mockLayer],
- layerData: [[1, 2], [3, 4], [5, 6], [7, 8]],
+ layerData: [
+ [1, 2],
+ [3, 4],
+ [5, 6],
+ [7, 8]
+ ],
datasets: {
snowflake: {
fields: [{id: 'a'}, {id: 'b'}],
@@ -1244,7 +1115,12 @@ test('#visStateReducer -> UPDATE_VIS_DATA.3 -> merge w/ existing state', t => {
filteredIndexForDomain: mockRawData.rows.map((_, i) => i),
allIndexes: mockRawData.rows.map((_, i) => i),
gpuFilter: {
- filterRange: [[0, 0], [0, 0], [0, 0], [0, 0]],
+ filterRange: [
+ [0, 0],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
filterValueUpdateTriggers: {
gpuFilter_0: null,
gpuFilter_1: null,
@@ -1308,31 +1184,15 @@ test('#visStateReducer -> UPDATE_VIS_DATA.3 -> merge w/ existing state', t => {
Object.keys(expectedDatasets).forEach(key =>
cmpDataset(t, expectedDatasets[key], newState.datasets[key])
);
- t.equal(
- newState.layers.length,
- 5,
- 'should find 1 arc aline and 2 point layers'
- );
+ t.equal(newState.layers.length, 5, 'should find 1 arc aline and 2 point layers');
t.deepEqual(
newState.layerOrder,
[1, 2, 3, 4, 0],
'should add new layer index to layer order, put them on top'
);
- t.equal(
- newState.layers[1].config.dataId,
- 'smoothie',
- 'should save dataId to layer'
- );
- t.equal(
- newState.layers[2].config.dataId,
- 'smoothie',
- 'should save dataId to layer'
- );
- t.equal(
- newState.layers[3].config.dataId,
- 'smoothie',
- 'should save dataId to layer'
- );
+ t.equal(newState.layers[1].config.dataId, 'smoothie', 'should save dataId to layer');
+ t.equal(newState.layers[2].config.dataId, 'smoothie', 'should save dataId to layer');
+ t.equal(newState.layers[3].config.dataId, 'smoothie', 'should save dataId to layer');
t.equal(newState.layerData.length, 5, 'should calculate layerData');
t.equal(newState.filters.length, 2, 'should keep original filters');
t.deepEqual(
@@ -1363,10 +1223,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> geojson data', t => {
const [layer1Color, layer1StrokeColor] = getNextColorMakerValue(2);
// receive data
- const initialState = reducer(
- initialVisState,
- VisStateActions.updateVisData(payload)
- );
+ const initialState = reducer(initialVisState, VisStateActions.updateVisData(payload));
const expectedDatasets = {
id: 'milkshake',
@@ -1379,7 +1236,12 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> geojson data', t => {
fields: fields.map(f => ({...f, id: f.name})),
fieldPairs: [],
gpuFilter: {
- filterRange: [[0, 0], [0, 0], [0, 0], [0, 0]],
+ filterRange: [
+ [0, 0],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
filterValueUpdateTriggers: {
gpuFilter_0: null,
gpuFilter_1: null,
@@ -1416,11 +1278,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> geojson data', t => {
}))
};
- t.deepEqual(
- Object.keys(initialState.datasets),
- ['milkshake'],
- 'should save geojson to datasets'
- );
+ t.deepEqual(Object.keys(initialState.datasets), ['milkshake'], 'should save geojson to datasets');
cmpDataset(
t,
expectedDatasets,
@@ -1429,12 +1287,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> geojson data', t => {
);
t.equal(initialState.layers.length, 1, 'should find 1 geojson layer');
- cmpLayers(
- t,
- expectedLayer,
- initialState.layers[0],
- 'should save dataFeature to geojson layer'
- );
+ cmpLayers(t, expectedLayer, initialState.layers[0], 'should save dataFeature to geojson layer');
t.deepEqual(
initialState.layerData[0].data,
@@ -1461,10 +1314,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> with config', t => {
];
// receive data
- const initialState = reducer(
- initialVisState,
- VisStateActions.updateVisData(payload)
- );
+ const initialState = reducer(initialVisState, VisStateActions.updateVisData(payload));
t.equal(initialState.layers.length, 1, 'should create 1 layer');
@@ -1498,10 +1348,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> with config', t => {
}
};
- const testState = reducer(
- initialState,
- VisStateActions.updateVisData(datasets, {}, config)
- );
+ const testState = reducer(initialState, VisStateActions.updateVisData(datasets, {}, config));
t.deepEqual(
Object.keys(testState.datasets),
@@ -1509,11 +1356,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA.4.Geojson -> with config', t => {
'should reset state, and load dataset'
);
t.equal(testState.layers.length, 1, 'should create 1 layer');
- t.equal(
- testState.layers[0].id,
- 'test_layer_2',
- 'should merge 1 layer from config'
- );
+ t.equal(testState.layers[0].id, 'test_layer_2', 'should merge 1 layer from config');
t.end();
});
@@ -1585,10 +1428,14 @@ test('#visStateReducer -> UPDATE_VIS_DATA -> mergeFilters', t => {
const expectedDatasets = {
smoothie: {
- fields: expectedFields.map(f => f.name === mockFilter.name ? {
- ...f,
- filterProps: expectedFilterProps
- } : f),
+ fields: expectedFields.map(f =>
+ f.name === mockFilter.name
+ ? {
+ ...f,
+ filterProps: expectedFilterProps
+ }
+ : f
+ ),
// gpu filter in place, filteredIndex should not be updated
filteredIndex: allIndexes,
filteredIndexForDomain: [0],
@@ -1600,7 +1447,10 @@ test('#visStateReducer -> UPDATE_VIS_DATA -> mergeFilters', t => {
},
gpuFilter: {
filterRange: [
- [mockFilter.value[0] - expectedFilter.domain[0], mockFilter.value[1] - expectedFilter.domain[0]],
+ [
+ mockFilter.value[0] - expectedFilter.domain[0],
+ mockFilter.value[1] - expectedFilter.domain[0]
+ ],
[0, 0],
[0, 0],
[0, 0]
@@ -1655,9 +1505,7 @@ test('#visStateReducer -> UPDATE_VIS_DATA -> mergeFilters', t => {
};
const expectedState = {
- filterToBeMerged: [
- oldState.filterToBeMerged[1]
- ],
+ filterToBeMerged: [oldState.filterToBeMerged[1]],
filters: [expectedFilter],
datasets: expectedDatasets
};
@@ -1765,21 +1613,9 @@ test('#visStateReducer -> UPDATE_VIS_DATA.SPLIT_MAPS', t => {
}
];
- t.equal(
- newState.layers.length,
- 8,
- 'should create 1 arc 1 line and 2 point layers'
- );
- t.deepEqual(
- newState.layerOrder,
- [4, 5, 6, 7, 2, 1, 0, 3],
- 'should move new layers to front'
- );
- t.deepEqual(
- newState.splitMaps,
- expectedSplitMaps,
- 'should add new layers to split maps'
- );
+ t.equal(newState.layers.length, 8, 'should create 1 arc 1 line and 2 point layers');
+ t.deepEqual(newState.layerOrder, [4, 5, 6, 7, 2, 1, 0, 3], 'should move new layers to front');
+ t.deepEqual(newState.splitMaps, expectedSplitMaps, 'should add new layers to split maps');
t.end();
});
@@ -1822,10 +1658,7 @@ test('#visStateReducer -> setFilter.dynamicDomain & cpu', t => {
cmpLayers(t, expectedLayers, initialState.layers);
// add filter
- const stateWithFilter = reducer(
- initialState,
- VisStateActions.addFilter('smoothie')
- );
+ const stateWithFilter = reducer(initialState, VisStateActions.addFilter('smoothie'));
const expectedFilter = {
dataId: ['smoothie'],
@@ -1897,10 +1730,7 @@ test('#visStateReducer -> setFilter.dynamicDomain & cpu', t => {
label: 'queen smoothie',
color: 'donnot test me',
allData,
- fields: [
- ...initialState.datasets.smoothie.fields.slice(0, 10),
- updatedField
- ],
+ fields: [...initialState.datasets.smoothie.fields.slice(0, 10), updatedField],
filteredIndex: allData.map((d, i) => i),
filteredIndexForDomain: allData.map((d, i) => i),
allIndexes: allData.map((d, i) => i),
@@ -1911,7 +1741,12 @@ test('#visStateReducer -> setFilter.dynamicDomain & cpu', t => {
gpu: []
},
gpuFilter: {
- filterRange: [[0, 0], [0, 0], [0, 0], [0, 0]],
+ filterRange: [
+ [0, 0],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
filterValueUpdateTriggers: {
gpuFilter_0: null,
gpuFilter_1: null,
@@ -1972,11 +1807,7 @@ test('#visStateReducer -> setFilter.dynamicDomain & cpu', t => {
filteredIndexForDomain: [17, 18, 19, 20, 21, 22]
};
- cmpDataset(
- t,
- expectedFilteredDataset,
- stateWithFilterValue.datasets.smoothie
- );
+ cmpDataset(t, expectedFilteredDataset, stateWithFilterValue.datasets.smoothie);
const expectedLayerData1 = {
data: [
@@ -1987,12 +1818,9 @@ test('#visStateReducer -> setFilter.dynamicDomain & cpu', t => {
{data: allData[21], index: 21, position: [31.2187021, 30.0614122, 0]},
{data: allData[22], index: 22, position: [31.2191059, 30.0612697, 0]}
],
- getPosition: () => {
- },
- getColor: () => {
- },
- getRadius: () => {
- }
+ getPosition: () => {},
+ getColor: () => {},
+ getRadius: () => {}
};
t.deepEqual(
@@ -2008,10 +1836,7 @@ test('#visStateReducer -> SET_FILTER.name', t => {
const oldState = StateWFilters.visState;
const oldFilter0 = oldState.filters[0];
// change filter name from RATE to ZIP_CODE
- const updated = reducer(
- oldState,
- VisStateActions.setFilter(1, 'name', 'ZIP_CODE', 0)
- );
+ const updated = reducer(oldState, VisStateActions.setFilter(1, 'name', 'ZIP_CODE', 0));
const expectedFilter0 = oldFilter0;
const expectedFilter1 = {
@@ -2088,16 +1913,10 @@ test('#visStateReducer -> setFilter.dynamicDomain & gpu', t => {
];
// receive data
- const initialState = reducer(
- INITIAL_VIS_STATE,
- VisStateActions.updateVisData(payload)
- );
+ const initialState = reducer(INITIAL_VIS_STATE, VisStateActions.updateVisData(payload));
// add filter
- const stateWithFilter = reducer(
- initialState,
- VisStateActions.addFilter('milkshake')
- );
+ const stateWithFilter = reducer(initialState, VisStateActions.addFilter('milkshake'));
// set filter 'name'
const stateWithFilterName = reducer(
@@ -2155,14 +1974,19 @@ test('#visStateReducer -> setFilter.dynamicDomain & gpu', t => {
fields: geojsonFields.map(f =>
f.name === 'TRIPS'
? {
- ...f,
- id: f.name,
- filterProps: geoJsonTripFilterProps
- }
+ ...f,
+ id: f.name,
+ filterProps: geoJsonTripFilterProps
+ }
: {...f, id: f.name}
),
gpuFilter: {
- filterRange: [[4, 16], [0, 0], [0, 0], [0, 0]],
+ filterRange: [
+ [4, 16],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
filterValueUpdateTriggers: {
gpuFilter_0: 'TRIPS',
gpuFilter_1: null,
@@ -2170,9 +1994,7 @@ test('#visStateReducer -> setFilter.dynamicDomain & gpu', t => {
gpuFilter_3: null
},
filterValueAccessor: {
- inputs: [
- {data: initialState.datasets.milkshake.allData[0], index: 0}
- ],
+ inputs: [{data: initialState.datasets.milkshake.allData[0], index: 0}],
result: [7, 0, 0, 0]
}
},
@@ -2196,17 +2018,9 @@ test('#visStateReducer -> setFilter.dynamicDomain & gpu', t => {
'trip field keys should be same'
);
Object.keys(actualTripField).forEach(k => {
- t.deepEqual(
- actualTripField[k],
- expectedField[k],
- `trip field ${k} should be same`
- );
+ t.deepEqual(actualTripField[k], expectedField[k], `trip field ${k} should be same`);
});
- cmpDataset(
- t,
- expectedFilteredDataset,
- stateWithFilterValue.datasets.milkshake
- );
+ cmpDataset(t, expectedFilteredDataset, stateWithFilterValue.datasets.milkshake);
t.end();
});
@@ -2215,16 +2029,9 @@ test('#visStateReducer -> setFilter.dynamicDomain & gpu', t => {
test('#visStateReducer -> UPDATE_FILTER_ANIMATION_SPEED', t => {
const initialState = StateWFilters.visState;
- const nextState = reducer(
- initialState,
- VisStateActions.updateFilterAnimationSpeed(0, 4)
- );
+ const nextState = reducer(initialState, VisStateActions.updateFilterAnimationSpeed(0, 4));
- t.equal(
- nextState.filters[0].speed,
- 4,
- 'should update filter animation speed'
- );
+ t.equal(nextState.filters[0].speed, 4, 'should update filter animation speed');
t.end();
});
@@ -2329,22 +2136,21 @@ test('#visStateReducer -> setFilter.fixedDomain & DynamicDomain & gpu & cpu', t
fields: datasetSmoothie.fields.map(f =>
f.name === 'gps_data.utc_timestamp'
? {
- ...f,
- filterProps: {
- domain: [1474070995000, 1474072208000],
- step: 1000,
- mappedValue: expectedFilterTs.mappedValue,
- histogram: stateWidthTsFilter.filters[0].histogram,
- enlargedHistogram:
- stateWidthTsFilter.filters[0].enlargedHistogram,
- fieldType: 'timestamp',
- type: 'timeRange',
- enlarged: true,
- fixedDomain: true,
- value: [1474070995000, 1474072208000],
- gpu: true
+ ...f,
+ filterProps: {
+ domain: [1474070995000, 1474072208000],
+ step: 1000,
+ mappedValue: expectedFilterTs.mappedValue,
+ histogram: stateWidthTsFilter.filters[0].histogram,
+ enlargedHistogram: stateWidthTsFilter.filters[0].enlargedHistogram,
+ fieldType: 'timestamp',
+ type: 'timeRange',
+ enlarged: true,
+ fixedDomain: true,
+ value: [1474070995000, 1474072208000],
+ gpu: true
+ }
}
- }
: f
),
filterRecord: {
@@ -2354,7 +2160,12 @@ test('#visStateReducer -> setFilter.fixedDomain & DynamicDomain & gpu & cpu', t
gpu: [stateWidthTsFilter.filters[0]]
},
gpuFilter: {
- filterRange: [[1474071425000 - 1474070995000, 1474071740000 - 1474070995000], [0, 0], [0, 0], [0, 0]],
+ filterRange: [
+ [1474071425000 - 1474070995000, 1474071740000 - 1474070995000],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
filterValueUpdateTriggers: {
gpuFilter_0: 'gps_data.utc_timestamp',
gpuFilter_1: null,
@@ -2362,9 +2173,7 @@ test('#visStateReducer -> setFilter.fixedDomain & DynamicDomain & gpu & cpu', t
gpuFilter_3: null
},
filterValueAccessor: {
- inputs: [
- {data: datasetSmoothie.allData[1], index: 1}
- ],
+ inputs: [{data: datasetSmoothie.allData[1], index: 1}],
result: [61000, 0, 0, 0]
}
},
@@ -2398,19 +2207,24 @@ test('#visStateReducer -> setFilter.fixedDomain & DynamicDomain & gpu & cpu', t
fields: stateWidthTsFilter.datasets.smoothie.fields.map(f =>
f.name === 'date'
? {
- ...f,
- filterProps: {
- domain: ['2016-09-23', '2016-09-24', '2016-10-10'],
- fieldType: 'date',
- type: 'multiSelect',
- value: [],
- gpu: false
+ ...f,
+ filterProps: {
+ domain: ['2016-09-23', '2016-09-24', '2016-10-10'],
+ fieldType: 'date',
+ type: 'multiSelect',
+ value: [],
+ gpu: false
+ }
}
- }
: f
),
gpuFilter: {
- filterRange: [[1474071425000 - 1474070995000, 1474071740000 - 1474070995000], [0, 0], [0, 0], [0, 0]],
+ filterRange: [
+ [1474071425000 - 1474070995000, 1474071740000 - 1474070995000],
+ [0, 0],
+ [0, 0],
+ [0, 0]
+ ],
filterValueUpdateTriggers: {
gpuFilter_0: 'gps_data.utc_timestamp',
gpuFilter_1: null,
@@ -2418,9 +2232,7 @@ test('#visStateReducer -> setFilter.fixedDomain & DynamicDomain & gpu & cpu', t
gpuFilter_3: null
},
filterValueAccessor: {
- inputs: [
- {data: datasetSmoothie.allData[1], index: 1}
- ],
+ inputs: [{data: datasetSmoothie.allData[1], index: 1}],
result: [61000, 0, 0, 0]
}
},
@@ -2453,16 +2265,10 @@ test('#visStateReducer -> SET_FILTER_PLOT', t => {
];
// receive data
- const initialState = reducer(
- INITIAL_VIS_STATE,
- VisStateActions.updateVisData(payload)
- );
+ const initialState = reducer(INITIAL_VIS_STATE, VisStateActions.updateVisData(payload));
// add filter
- const stateWithFilter = reducer(
- initialState,
- VisStateActions.addFilter('smoothie')
- );
+ const stateWithFilter = reducer(initialState, VisStateActions.addFilter('smoothie'));
const filterId = stateWithFilter.filters[0].id;
// set filter 'name' to timestamp field
@@ -2472,9 +2278,7 @@ test('#visStateReducer -> SET_FILTER_PLOT', t => {
);
// find id which is an integer field
- const yAxisField = stateWithFilterName.datasets.smoothie.fields.find(
- f => f.id === 'id'
- );
+ const yAxisField = stateWithFilterName.datasets.smoothie.fields.find(f => f.id === 'id');
// set filterPlot yAxis
const stateWithFilterPlot = reducer(
@@ -2567,15 +2371,8 @@ test('#visStateReducer -> SET_FILTER_PLOT', t => {
test('#visStateReducer -> TOGGLE_FILTER_ANIMATION', t => {
const initialState = StateWFilters.visState;
- const nextState = reducer(
- initialState,
- VisStateActions.toggleFilterAnimation(0)
- );
- t.equal(
- nextState.filters[0].isAnimating,
- true,
- 'should set filter to isAnimating: true'
- );
+ const nextState = reducer(initialState, VisStateActions.toggleFilterAnimation(0));
+ t.equal(nextState.filters[0].isAnimating, true, 'should set filter to isAnimating: true');
t.end();
});
@@ -2585,35 +2382,20 @@ test('#visStateReducer -> ENLARGE_FILTER', t => {
const nextState = reducer(initialState, VisStateActions.enlargeFilter(0));
- t.equal(
- nextState.filters[0].enlarged,
- false,
- 'should toggle time filter enlarged to be false'
- );
+ t.equal(nextState.filters[0].enlarged, false, 'should toggle time filter enlarged to be false');
const nextState2 = reducer(nextState, VisStateActions.enlargeFilter(0));
- t.equal(
- nextState2.filters[0].enlarged,
- true,
- 'should toggle time filter enlarged to be true'
- );
+ t.equal(nextState2.filters[0].enlarged, true, 'should toggle time filter enlarged to be true');
t.end();
});
test('#visStateReducer -> REMOVE_DATASET', t => {
const initialState = StateWFilters.visState;
- const nextState = reducer(
- initialState,
- VisStateActions.removeDataset('not_me')
- );
+ const nextState = reducer(initialState, VisStateActions.removeDataset('not_me'));
- t.equal(
- initialState,
- nextState,
- 'should return state if datasetKey doesnot exist'
- );
+ t.equal(initialState, nextState, 'should return state if datasetKey doesnot exist');
t.end();
});
@@ -2662,10 +2444,7 @@ test('#visStateReducer -> REMOVE_DATASET w filter and layer', t => {
}
};
- const newReducer = reducer(
- oldState,
- VisStateActions.removeDataset(testCsvDataId)
- );
+ const newReducer = reducer(oldState, VisStateActions.removeDataset(testCsvDataId));
t.deepEqual(
Object.keys(newReducer).sort(),
@@ -2673,11 +2452,7 @@ test('#visStateReducer -> REMOVE_DATASET w filter and layer', t => {
`visState should have same keys`
);
Object.keys(expectedState).forEach(key => {
- t.deepEqual(
- newReducer[key],
- expectedState[key],
- `newReducer.${key} should be correct`
- );
+ t.deepEqual(newReducer[key], expectedState[key], `newReducer.${key} should be correct`);
});
t.end();
@@ -2885,10 +2660,7 @@ test('#visStateReducer -> SPLIT_MAP: REMOVE_DATASET', t => {
}
};
- const newReducer = reducer(
- oldState,
- VisStateActions.removeDataset(testGeoJsonDataId)
- );
+ const newReducer = reducer(oldState, VisStateActions.removeDataset(testGeoJsonDataId));
t.deepEqual(
Object.keys(newReducer).sort(),
@@ -2896,11 +2668,7 @@ test('#visStateReducer -> SPLIT_MAP: REMOVE_DATASET', t => {
`visState should have same keys`
);
Object.keys(expectedState).forEach(key => {
- t.deepEqual(
- newReducer[key],
- expectedState[key],
- `newReducer.${key} should be correct`
- );
+ t.deepEqual(newReducer[key], expectedState[key], `newReducer.${key} should be correct`);
});
t.end();
@@ -2933,26 +2701,14 @@ test('#visStateReducer -> SPLIT_MAP: ADD_LAYER', t => {
const newReducer = reducer(oldState, VisStateActions.addLayer());
- t.equal(
- newReducer.layers[1].config.isVisible,
- true,
- 'newLayer visibility should be set to true'
- );
+ t.equal(newReducer.layers[1].config.isVisible, true, 'newLayer visibility should be set to true');
t.equal(
newReducer.layers[1].config.isConfigActive,
true,
'newLayer isConfigActive should be set to true'
);
- t.equal(
- newReducer.layers[1].config.dataId,
- 'puppy',
- 'newLayer dataId should be set to default'
- );
- t.equal(
- newReducer.splitMaps.length,
- 2,
- 'newLayer was added into splitMaps layers'
- );
+ t.equal(newReducer.layers[1].config.dataId, 'puppy', 'newLayer dataId should be set to default');
+ t.equal(newReducer.splitMaps.length, 2, 'newLayer was added into splitMaps layers');
t.deepEqual(
newReducer.splitMaps[0],
{
@@ -3052,42 +2808,24 @@ test('#visStateReducer -> SPLIT_MAP: HIDE LAYER', t => {
]
};
- t.deepEqual(
- newState.splitMaps,
- expectedState.splitMaps,
- 'should hide layer B in split map'
- );
+ t.deepEqual(newState.splitMaps, expectedState.splitMaps, 'should hide layer B in split map');
t.end();
});
test('#visStateReducer -> UPDATE_ANIMATION_TIME', t => {
const initialState = StateWTripGeojson;
- const newState = reducer(
- initialState,
- VisStateActions.updateAnimationTime(1000)
- );
+ const newState = reducer(initialState, VisStateActions.updateAnimationTime(1000));
- t.equal(
- newState.animationConfig.currentTime,
- 1000,
- 'should update animation time'
- );
+ t.equal(newState.animationConfig.currentTime, 1000, 'should update animation time');
t.end();
});
test('#visStateReducer -> UPDATE_LAYER_ANIMATION_SPEED', t => {
const initialState = StateWTripGeojson;
- const newState = reducer(
- initialState,
- VisStateActions.updateLayerAnimationSpeed(1.23)
- );
+ const newState = reducer(initialState, VisStateActions.updateLayerAnimationSpeed(1.23));
- t.equal(
- newState.animationConfig.speed,
- 1.23,
- 'should update animation speed'
- );
+ t.equal(newState.animationConfig.speed, 1.23, 'should update animation speed');
t.end();
});
@@ -3114,21 +2852,14 @@ test('#visStateReducer -> INTERACTION_CONFIG_CHANGE', t => {
VisStateActions.interactionConfigChange(brushConfig)
);
- t.deepEqual(
- nextState.interactionConfig,
- expectedConfig,
- 'should disable tooltip'
- );
+ t.deepEqual(nextState.interactionConfig, expectedConfig, 'should disable tooltip');
t.end();
});
test('#visStateReducer -> SHOW_DATASET_TABLE', t => {
const initialState = StateWFiles.visState;
- const nextState = reducer(
- initialState,
- VisStateActions.showDatasetTable('abc')
- );
+ const nextState = reducer(initialState, VisStateActions.showDatasetTable('abc'));
t.equal(nextState.editingDataset, 'abc', 'should set editingDataset');
t.end();
@@ -3180,10 +2911,7 @@ test('#visStateReducer -> MOUSE_MOVE', t => {
enabled: false
};
- const nextState1 = reducer(
- nextState,
- VisStateActions.interactionConfigChange(tooltipConfig)
- );
+ const nextState1 = reducer(nextState, VisStateActions.interactionConfigChange(tooltipConfig));
const nextState2 = reducer(
nextState1,
@@ -3283,11 +3011,7 @@ test('#visStateReducer -> LAYER_COLOR_UI_CHANGE. colorRangeConfig.step', t => {
const oldColorRange = CloneDeep(pointLayer.config.visConfig.colorRange);
- t.equal(
- oldColorRange.colors.length,
- 4,
- 'old color range should have 4 colors'
- );
+ t.equal(oldColorRange.colors.length, 4, 'old color range should have 4 colors');
// show dropdown
const prepareState = reducer(
initialState,
@@ -3569,11 +3293,7 @@ test('#visStateReducer -> LAYER_COLOR_UI_CHANGE. custom Palette', t => {
}
};
- t.deepEqual(
- nextState3.layers[0].config.colorUI,
- expectedColorUI3,
- 'should set showSketcher: 1'
- );
+ t.deepEqual(nextState3.layers[0].config.colorUI, expectedColorUI3, 'should set showSketcher: 1');
// edit color
const nextState4 = reducer(
@@ -3713,45 +3433,24 @@ test('#visStateReducer -> LAYER_COLOR_UI_CHANGE. custom Palette', t => {
test('#visStateReducer -> setFeatures/delete', t => {
const expectedFeatures = [mockPolygonFeature];
- let newReducer = reducer(
- INITIAL_VIS_STATE,
- VisStateActions.setFeatures([mockPolygonFeature])
- );
+ let newReducer = reducer(INITIAL_VIS_STATE, VisStateActions.setFeatures([mockPolygonFeature]));
- t.deepEqual(
- newReducer.editor.features,
- expectedFeatures,
- 'should add new feature'
- );
+ t.deepEqual(newReducer.editor.features, expectedFeatures, 'should add new feature');
newReducer = reducer(newReducer, VisStateActions.deleteFeature(mockPolygonFeature));
- t.deepEqual(
- newReducer.editor.features,
- [],
- 'Should not have features'
- );
+ t.deepEqual(newReducer.editor.features, [], 'Should not have features');
t.end();
});
test('#visStateReducer -> POLYGON: Add/Remove new polygon feature', t => {
const expectedFeatures = [mockPolygonFeature];
- let newReducer = reducer(
- INITIAL_VIS_STATE,
- VisStateActions.setFeatures([mockPolygonFeature])
- );
+ let newReducer = reducer(INITIAL_VIS_STATE, VisStateActions.setFeatures([mockPolygonFeature]));
- t.deepEqual(
- newReducer.editor.features,
- expectedFeatures,
- 'should add new feature'
- );
+ t.deepEqual(newReducer.editor.features, expectedFeatures, 'should add new feature');
- newReducer = reducer(
- newReducer,
- VisStateActions.setSelectedFeature(mockPolygonFeature)
- );
+ newReducer = reducer(newReducer, VisStateActions.setSelectedFeature(mockPolygonFeature));
const updatedFeature = {
...mockPolygonFeature,
@@ -3759,31 +3458,16 @@ test('#visStateReducer -> POLYGON: Add/Remove new polygon feature', t => {
...mockPolygonFeature.geometry,
coordinates: [
[
- [
- 12.0,
- 30.0
- ],
- [
- 12.0,
- 36.0
- ],
- [
- 12.5,
- 36.0
- ],
- [
- 12.0,
- 30.0
- ]
+ [12.0, 30.0],
+ [12.0, 36.0],
+ [12.5, 36.0],
+ [12.0, 30.0]
]
]
}
};
- newReducer = reducer(
- newReducer,
- VisStateActions.setFeatures([updatedFeature])
- );
+ newReducer = reducer(newReducer, VisStateActions.setFeatures([updatedFeature]));
t.deepEqual(
newReducer.editor.selectedFeature.id,
@@ -3791,10 +3475,7 @@ test('#visStateReducer -> POLYGON: Add/Remove new polygon feature', t => {
'should set selected feature'
);
- newReducer = reducer(
- newReducer,
- VisStateActions.deleteFeature(mockPolygonFeature)
- );
+ newReducer = reducer(newReducer, VisStateActions.deleteFeature(mockPolygonFeature));
t.deepEqual(
newReducer.editor,
@@ -3870,10 +3551,7 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
newReducer = reducer(newReducer, VisStateActions.setFeatures([mockPolygonFeature]));
// set selected feature
- newReducer = reducer(
- newReducer,
- VisStateActions.setSelectedFeature(mockPolygonFeature)
- );
+ newReducer = reducer(newReducer, VisStateActions.setSelectedFeature(mockPolygonFeature));
// set it as filter
newReducer = reducer(
@@ -3911,23 +3589,11 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
gpu: false
};
- t.deepEqual(
- newFilter,
- expectedFilter,
- 'Should have created a polygon filter'
- );
+ t.deepEqual(newFilter, expectedFilter, 'Should have created a polygon filter');
- t.equal(
- newReducer.layerData[0].data.length,
- 2,
- 'Layer Point 1 should only show 2 points'
- );
+ t.equal(newReducer.layerData[0].data.length, 2, 'Layer Point 1 should only show 2 points');
- t.equal(
- newReducer.layerData[1].data.length,
- 2,
- 'Layer Point 2 should only show 2 points'
- );
+ t.equal(newReducer.layerData[1].data.length, 2, 'Layer Point 2 should only show 2 points');
const filterFeature = newReducer.filters[0].value;
@@ -3937,38 +3603,18 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
VisStateActions.setPolygonFilterLayer(newReducer.layers[1], filterFeature)
);
- t.equal(
- newReducer.filters.length,
- 1,
- 'Should still have 1 polygon filter'
- );
+ t.equal(newReducer.filters.length, 1, 'Should still have 1 polygon filter');
- t.equal(
- newReducer.filters[0].layerId.length,
- 2,
- 'Should have two values in filter.layerId'
- );
+ t.equal(newReducer.filters[0].layerId.length, 2, 'Should have two values in filter.layerId');
- t.equal(
- newReducer.layerData[0].data.length,
- 0,
- 'Layer Point 1 should show 0 points'
- );
+ t.equal(newReducer.layerData[0].data.length, 0, 'Layer Point 1 should show 0 points');
- t.equal(
- newReducer.layerData[1].data.length,
- 0,
- 'Layer Point 2 show show 0 points'
- );
+ t.equal(newReducer.layerData[1].data.length, 0, 'Layer Point 2 show show 0 points');
// Adding a new dataset - creates extra 4 layers
newReducer = reducer(newReducer, VisStateActions.updateVisData(datasets, options, {}));
- t.equal(
- newReducer.layerData[4].data.length,
- 4,
- 'Layer Point 5 should full data'
- );
+ t.equal(newReducer.layerData[4].data.length, 4, 'Layer Point 5 should full data');
// Set polygon for a different dataset layer
newReducer = reducer(
@@ -3976,23 +3622,11 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
VisStateActions.setPolygonFilterLayer(newReducer.layers[4], filterFeature)
);
- t.equal(
- newReducer.filters[0].layerId.length,
- 3,
- 'Should 3 values in filter.layerId'
- );
+ t.equal(newReducer.filters[0].layerId.length, 3, 'Should 3 values in filter.layerId');
- t.equal(
- newReducer.filters[0].dataId.length,
- 2,
- 'Should have two values in filter.dataId'
- );
+ t.equal(newReducer.filters[0].dataId.length, 2, 'Should have two values in filter.dataId');
- t.equal(
- newReducer.layerData[4].data.length,
- 2,
- 'Layer Point 5 should 2 points because filtered'
- );
+ t.equal(newReducer.layerData[4].data.length, 2, 'Layer Point 5 should 2 points because filtered');
// Remove second layer from filter
newReducer = reducer(
@@ -4000,17 +3634,9 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
VisStateActions.setPolygonFilterLayer(newReducer.layers[1], filterFeature)
);
- t.equal(
- newReducer.filters[0].layerId.length,
- 2,
- 'Should 3 values in filter.layerId'
- );
+ t.equal(newReducer.filters[0].layerId.length, 2, 'Should 3 values in filter.layerId');
- t.equal(
- newReducer.filters[0].dataId.length,
- 2,
- 'Should have two values in filter.dataId'
- );
+ t.equal(newReducer.filters[0].dataId.length, 2, 'Should have two values in filter.dataId');
t.equal(
newReducer.layerData[0].data.length,
@@ -4018,11 +3644,7 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
'Layer Point 1 show 2 points because we removed layer 2'
);
- t.equal(
- newReducer.layerData[4].data.length,
- 2,
- 'Layer Point 5 should 2 points because filtered'
- );
+ t.equal(newReducer.layerData[4].data.length, 2, 'Layer Point 5 should 2 points because filtered');
t.equal(
newReducer.layerData[2].data.length,
@@ -4053,20 +3675,13 @@ test('#visStateReducer -> POLYGON: Toggle filter feature', t => {
let newReducer = reducer(state, VisStateActions.addLayer());
- t.equal(
- newReducer.layers.length,
- 1,
- 'Should have created a new layer'
- );
+ t.equal(newReducer.layers.length, 1, 'Should have created a new layer');
// add new polygon feature
newReducer = reducer(newReducer, VisStateActions.setFeatures([mockPolygonFeature]));
// set selected feature
- newReducer = reducer(
- newReducer,
- VisStateActions.setSelectedFeature(mockPolygonFeature)
- );
+ newReducer = reducer(newReducer, VisStateActions.setSelectedFeature(mockPolygonFeature));
// set it as filter
newReducer = reducer(
@@ -4103,11 +3718,7 @@ test('#visStateReducer -> POLYGON: Toggle filter feature', t => {
gpu: false
};
- t.deepEqual(
- newFilter,
- expectedFilter,
- 'Should have created a polygon filter'
- );
+ t.deepEqual(newFilter, expectedFilter, 'Should have created a polygon filter');
let filterFeature = newReducer.filters[0].value;
@@ -4121,11 +3732,7 @@ test('#visStateReducer -> POLYGON: Toggle filter feature', t => {
filterFeature = newReducer.filters[0].value;
- t.deepEqual(
- filterFeature.properties.isVisible,
- false,
- 'Should hide filter feature'
- );
+ t.deepEqual(filterFeature.properties.isVisible, false, 'Should hide filter feature');
t.end();
});
@@ -4146,20 +3753,13 @@ test('#visStateReducer -> POLYGON: delete polygon filter', t => {
let newReducer = reducer(state, VisStateActions.addLayer());
- t.equal(
- newReducer.layers.length,
- 1,
- 'Should have created a new layer'
- );
+ t.equal(newReducer.layers.length, 1, 'Should have created a new layer');
// add new polygon feature
newReducer = reducer(newReducer, VisStateActions.setFeatures([mockPolygonFeature]));
// set selected feature
- newReducer = reducer(
- newReducer,
- VisStateActions.setSelectedFeature(mockPolygonFeature)
- );
+ newReducer = reducer(newReducer, VisStateActions.setSelectedFeature(mockPolygonFeature));
// set it as filter
newReducer = reducer(
@@ -4168,41 +3768,19 @@ test('#visStateReducer -> POLYGON: delete polygon filter', t => {
);
// Update filters using setFilter
- newReducer = reducer(
- newReducer,
- VisStateActions.setFilter(0, 'layerId', [])
- );
+ newReducer = reducer(newReducer, VisStateActions.setFilter(0, 'layerId', []));
- t.deepEqual(
- newReducer.filters[0].layerId,
- [],
- 'Should have removed layers from filter'
- );
+ t.deepEqual(newReducer.filters[0].layerId, [], 'Should have removed layers from filter');
- t.deepEqual(
- newReducer.filters[0].dataId,
- [],
- 'Should have removed datasets from filter'
- );
+ t.deepEqual(newReducer.filters[0].dataId, [], 'Should have removed datasets from filter');
// unset it as filter
- newReducer = reducer(
- newReducer,
- VisStateActions.removeFilter(0)
- );
+ newReducer = reducer(newReducer, VisStateActions.removeFilter(0));
- t.deepEqual(
- newReducer.filters,
- [],
- 'Should have removed the created polygon filter'
- );
+ t.deepEqual(newReducer.filters, [], 'Should have removed the created polygon filter');
// deleting the filter will also delete the feature
- t.deepEqual(
- newReducer.editor.features.length,
- 0,
- 'Should have removed the feature'
- );
+ t.deepEqual(newReducer.editor.features.length, 0, 'Should have removed the feature');
t.end();
});
@@ -4210,11 +3788,7 @@ test('#visStateReducer -> POLYGON: delete polygon filter', t => {
test('#uiStateReducer -> SET_EDITOR_MODE', t => {
const newState = reducer(INITIAL_VIS_STATE, VisStateActions.setEditorMode(EDITOR_MODES.EDIT));
- t.equal(
- newState.editor.mode,
- EDITOR_MODES.EDIT,
- 'Editor mode should be set to vertex'
- );
+ t.equal(newState.editor.mode, EDITOR_MODES.EDIT, 'Editor mode should be set to vertex');
t.end();
});
@@ -4222,19 +3796,11 @@ test('#uiStateReducer -> SET_EDITOR_MODE', t => {
test('#uiStateReducer -> TOGGLE_EDITOR_VISIBILITY', t => {
let newState = reducer(INITIAL_VIS_STATE, VisStateActions.toggleEditorVisibility());
- t.equal(
- newState.editor.visible,
- false,
- 'Should set editor visibility to false'
- );
+ t.equal(newState.editor.visible, false, 'Should set editor visibility to false');
newState = reducer(newState, VisStateActions.toggleEditorVisibility());
- t.equal(
- newState.editor.visible,
- true,
- 'Should set editor visibility to true'
- );
+ t.equal(newState.editor.visible, true, 'Should set editor visibility to true');
t.end();
});
@@ -4244,10 +3810,7 @@ test('#visStateReducer -> APPLY_CPU_FILTER. no filter', t => {
const dataId = testCsvDataId;
const previousDataset = initialState.datasets[dataId];
- const nextState = reducer(
- initialState,
- VisStateActions.applyCPUFilter(dataId)
- );
+ const nextState = reducer(initialState, VisStateActions.applyCPUFilter(dataId));
const expectedDataset = {
...previousDataset,
@@ -4271,10 +3834,7 @@ test('#visStateReducer -> APPLY_CPU_FILTER. has gpu filter', t => {
const previousDataset = initialState.datasets[dataId];
const gpuFilter = initialState.filters[0];
- const nextState = reducer(
- initialState,
- VisStateActions.applyCPUFilter(dataId)
- );
+ const nextState = reducer(initialState, VisStateActions.applyCPUFilter(dataId));
const expectedDataset = {
...previousDataset,
@@ -4290,10 +3850,7 @@ test('#visStateReducer -> APPLY_CPU_FILTER. has gpu filter', t => {
cmpDataset(t, expectedDataset, nextState.datasets[dataId]);
// calling it again
- const nextState2 = reducer(
- nextState,
- VisStateActions.applyCPUFilter(dataId)
- );
+ const nextState2 = reducer(nextState, VisStateActions.applyCPUFilter(dataId));
t.equal(
nextState.datasets[dataId].filteredIdxCPU,
@@ -4310,10 +3867,7 @@ test('#visStateReducer -> APPLY_CPU_FILTER. has cpu filter', t => {
const previousDataset2 = initialState.datasets[dataId];
const ordinalFilter = initialState.filters[1];
- const nextState = reducer(
- initialState,
- VisStateActions.applyCPUFilter(dataId)
- );
+ const nextState = reducer(initialState, VisStateActions.applyCPUFilter(dataId));
const expectedDataset = {
...previousDataset2,
@@ -4328,10 +3882,7 @@ test('#visStateReducer -> APPLY_CPU_FILTER. has cpu filter', t => {
cmpDataset(t, expectedDataset, nextState.datasets[dataId]);
- const nextState2 = reducer(
- nextState,
- VisStateActions.applyCPUFilter(dataId)
- );
+ const nextState2 = reducer(nextState, VisStateActions.applyCPUFilter(dataId));
t.equal(
nextState.datasets[dataId].filteredIdxCPU,
@@ -4343,7 +3894,6 @@ test('#visStateReducer -> APPLY_CPU_FILTER. has cpu filter', t => {
});
test('#uiStateReducer -> SET_FEATURES/SET_SELECTED_FEATURE/DELETE_FEATURE', t => {
-
let newState = reducer(INITIAL_VIS_STATE, VisStateActions.setFeatures([]));
t.deepEqual(
@@ -4352,15 +3902,18 @@ test('#uiStateReducer -> SET_FEATURES/SET_SELECTED_FEATURE/DELETE_FEATURE', t =>
'Editor should not have features and return the same state'
);
- newState = reducer(INITIAL_VIS_STATE, VisStateActions.setFeatures([
- {
- ...mockPolygonFeature,
- properties: {
- ...mockPolygonFeature.properties,
- isClosed: false
+ newState = reducer(
+ INITIAL_VIS_STATE,
+ VisStateActions.setFeatures([
+ {
+ ...mockPolygonFeature,
+ properties: {
+ ...mockPolygonFeature.properties,
+ isClosed: false
+ }
}
- }
- ]));
+ ])
+ );
t.equal(
newState.editor.mode,
@@ -4368,22 +3921,21 @@ test('#uiStateReducer -> SET_FEATURES/SET_SELECTED_FEATURE/DELETE_FEATURE', t =>
'Editor mode should not change because feature is not closed'
);
- newState = reducer(newState, VisStateActions.setFeatures([
- {
- ...mockPolygonFeature,
- properties: {
- ...mockPolygonFeature.properties,
- isClosed: false
- }
- },
- mockPolygonFeature
- ]));
-
- t.equal(
- newState.editor.mode,
- EDITOR_MODES.EDIT,
- 'Editor mode should be set to edit_vertex'
+ newState = reducer(
+ newState,
+ VisStateActions.setFeatures([
+ {
+ ...mockPolygonFeature,
+ properties: {
+ ...mockPolygonFeature.properties,
+ isClosed: false
+ }
+ },
+ mockPolygonFeature
+ ])
);
+
+ t.equal(newState.editor.mode, EDITOR_MODES.EDIT, 'Editor mode should be set to edit_vertex');
t.end();
});
diff --git a/test/node/schemas/dataset-schema-test.js b/test/node/schemas/dataset-schema-test.js
index 45d6e3fe6..1b2e853c5 100644
--- a/test/node/schemas/dataset-schema-test.js
+++ b/test/node/schemas/dataset-schema-test.js
@@ -30,18 +30,8 @@ import {
expectedFields1,
expectedInfo1
} from 'test/fixtures/state-saved-v0';
-import {
- savedStateV1,
- v0ExpectedInfo,
- v0ExpectedFields
-} from 'test/fixtures/state-saved-v1-1';
-
-import {
- stateSavedV1_2,
- v1expectedInfo_2,
- v1expectedFields_2
-} from "test/fixtures/state-saved-v1-2";
-import {cmpDataset} from 'test/helpers/comparison-utils';
+import {savedStateV1, v0ExpectedInfo, v0ExpectedFields} from 'test/fixtures/state-saved-v1-1';
+import {stateSavedV1_2, v1expectedInfo_2, v1expectedFields_2} from 'test/fixtures/state-saved-v1-2';
/* eslint-disable max-statements */
test('#DatasetSchema -> SchemaManager.parseSavedData', t => {
@@ -69,47 +59,15 @@ test('#DatasetSchema -> SchemaManager.parseSavedData', t => {
};
t.equal(parsedValid.length, 2, 'should have 2 datasets');
- t.deepEqual(
- parsedValid[0],
- expectedDataset0,
- 'should parse dataset correctly'
- );
- t.deepEqual(
- parsedValid[0].info,
- expectedInfo0,
- 'should parse info correctly'
- );
- t.deepEqual(
- parsedValid[0].data.fields,
- expectedFields0,
- 'should parse fields correctly'
- );
- t.deepEqual(
- parsedValid[0].data.rows,
- expectedRows0,
- 'should parse rows correctly'
- );
+ t.deepEqual(parsedValid[0], expectedDataset0, 'should parse dataset correctly');
+ t.deepEqual(parsedValid[0].info, expectedInfo0, 'should parse info correctly');
+ t.deepEqual(parsedValid[0].data.fields, expectedFields0, 'should parse fields correctly');
+ t.deepEqual(parsedValid[0].data.rows, expectedRows0, 'should parse rows correctly');
- t.deepEqual(
- parsedValid[1],
- expectedDataset1,
- 'should parse dataset correctly'
- );
- t.deepEqual(
- parsedValid[1].info,
- expectedInfo1,
- 'should parse info correctly'
- );
- t.deepEqual(
- parsedValid[1].data.fields,
- expectedFields1,
- 'should parse fields correctly'
- );
- t.deepEqual(
- parsedValid[1].data.rows,
- expectedRows1,
- 'should parse rows correctly'
- );
+ t.deepEqual(parsedValid[1], expectedDataset1, 'should parse dataset correctly');
+ t.deepEqual(parsedValid[1].info, expectedInfo1, 'should parse info correctly');
+ t.deepEqual(parsedValid[1].data.fields, expectedFields1, 'should parse fields correctly');
+ t.deepEqual(parsedValid[1].data.rows, expectedRows1, 'should parse rows correctly');
t.end();
});
@@ -131,22 +89,10 @@ test('#DatasetSchema -> SchemaManager.parseSavedData.v1', t => {
t.equal(parsedValid.length, 1, 'should have 1 dataset');
- t.deepEqual(
- parsedValid[0],
- expectedDataset,
- 'should parse dataset correctly'
- );
+ t.deepEqual(parsedValid[0], expectedDataset, 'should parse dataset correctly');
t.deepEqual(parsedValid[0].info, v0ExpectedInfo, 'should parse info correctly');
- t.deepEqual(
- parsedValid[0].data.fields,
- v0ExpectedFields,
- 'should parse fields correctly'
- );
- t.deepEqual(
- parsedValid[0].data.rows,
- expectedRows,
- 'should parse rows correctly'
- );
+ t.deepEqual(parsedValid[0].data.fields, v0ExpectedFields, 'should parse fields correctly');
+ t.deepEqual(parsedValid[0].data.rows, expectedRows, 'should parse rows correctly');
t.end();
});
@@ -166,11 +112,7 @@ test('#DatasetSchema -> SchemaManager.parseSavedData.v1 with ts', t => {
t.equal(parsedValid.length, 1, 'should have 1 dataset');
- t.deepEqual(
- parsedValid[0],
- expectedDataset,
- 'should parse dataset correctly'
- );
+ t.deepEqual(parsedValid[0], expectedDataset, 'should parse dataset correctly');
t.deepEqual(parsedValid[0].info, v1expectedInfo_2, 'should parse info correctly');
@@ -188,11 +130,7 @@ test('#DatasetSchema -> SchemaManager.parseSavedData.v1 with ts', t => {
);
});
- t.deepEqual(
- parsedValid[0].data.rows,
- expectedRows,
- 'should parse rows correctly'
- );
+ t.deepEqual(parsedValid[0].data.rows, expectedRows, 'should parse rows correctly');
t.end();
});
diff --git a/test/node/schemas/map-state-schema-test.js b/test/node/schemas/map-state-schema-test.js
index b52729c43..d3ab0d321 100644
--- a/test/node/schemas/map-state-schema-test.js
+++ b/test/node/schemas/map-state-schema-test.js
@@ -31,9 +31,11 @@ test('#mapStateSchema -> v1 -> save load mapState', t => {
const msToSave = savedState.config.mapState;
const msLoaded = SchemaManager.parseSavedConfig(savedState).mapState;
- t.deepEqual(Object.keys(msToSave),
+ t.deepEqual(
+ Object.keys(msToSave),
['bearing', 'dragRotate', 'latitude', 'longitude', 'pitch', 'zoom', 'isSplit'],
- 'mapState should have all 6 entries');
+ 'mapState should have all 6 entries'
+ );
const expected = {
pitch: 0,
diff --git a/test/node/schemas/map-style-schema-test.js b/test/node/schemas/map-style-schema-test.js
index cfa2f4d87..b1c710a5f 100644
--- a/test/node/schemas/map-style-schema-test.js
+++ b/test/node/schemas/map-style-schema-test.js
@@ -31,9 +31,11 @@ test('#mapStyleSchema -> v1 -> save load mapStyle', t => {
const msToSave = savedState.config.mapStyle;
const msLoaded = SchemaManager.parseSavedConfig(savedState).mapStyle;
- t.deepEqual(Object.keys(msToSave),
+ t.deepEqual(
+ Object.keys(msToSave),
['styleType', 'topLayerGroups', 'visibleLayerGroups', 'threeDBuildingColor', 'mapStyles'],
- 'mapStyle should have all 4 entries');
+ 'mapStyle should have all 4 entries'
+ );
const expectedSaved = {
styleType: 'dark',
@@ -72,11 +74,12 @@ test('#mapStyleSchema -> v1 -> save load mapStyle with custom style', t => {
},
threeDBuildingColor: [1, 2, 3],
mapStyles: {
- 'smoothie_the_cat': {
+ smoothie_the_cat: {
id: 'smoothie_the_cat',
accessToken: 'secret_token',
label: 'Smoothie the Cat',
- icon: 'https://api.mapbox.com/styles/v1/shanhe/smoothie.the.cat/static/-122.3391,37.7922,9,0,0/400x300?access_token=secret_token&logo=false&attribution=false',
+ icon:
+ 'https://api.mapbox.com/styles/v1/shanhe/smoothie.the.cat/static/-122.3391,37.7922,9,0,0/400x300?access_token=secret_token&logo=false&attribution=false',
custom: true,
url: 'mapbox://styles/shanhe/smoothie.the.cat'
}
diff --git a/test/node/schemas/vis-state-schema-test.js b/test/node/schemas/vis-state-schema-test.js
index f0635cfe5..3bc65ff79 100644
--- a/test/node/schemas/vis-state-schema-test.js
+++ b/test/node/schemas/vis-state-schema-test.js
@@ -43,15 +43,13 @@ test('#visStateSchema -> v1 -> save layers', t => {
// save state
const vsToSave = SchemaManager.getConfigToSave(initialState).config.visState;
- t.deepEqual(Object.keys(vsToSave),
+ t.deepEqual(
+ Object.keys(vsToSave),
['filters', 'layers', 'interactionConfig', 'layerBlending', 'splitMaps', 'animationConfig'],
- 'visState should have all 5 entries');
+ 'visState should have all 5 entries'
+ );
- const exptectedSavedLayers = [
- expectedSavedLayer0,
- expectedSavedLayer1,
- expectedSavedLayer2
- ];
+ const exptectedSavedLayers = [expectedSavedLayer0, expectedSavedLayer1, expectedSavedLayer2];
const layersToSave = vsToSave.layers;
@@ -66,17 +64,15 @@ test('#visStateSchema -> v1 -> load layers', t => {
const savedState = SchemaManager.getConfigToSave(initialState);
const vsLoaded = SchemaManager.parseSavedConfig(savedState).visState;
- t.deepEqual(Object.keys(vsLoaded),
+ t.deepEqual(
+ Object.keys(vsLoaded),
['filters', 'layers', 'interactionConfig', 'layerBlending', 'splitMaps', 'animationConfig'],
- 'visState should have all 5 entries');
+ 'visState should have all 5 entries'
+ );
const loadedLayers = vsLoaded.layers;
- const expectedLoadedLayers = [
- expectedLoadedLayer0,
- expectedLoadedLayer1,
- expectedLoadedLayer2
- ];
+ const expectedLoadedLayers = [expectedLoadedLayer0, expectedLoadedLayer1, expectedLoadedLayer2];
cmpSavedLayers(t, expectedLoadedLayers, loadedLayers, {id: true});
t.end();
@@ -94,25 +90,28 @@ test('#visStateSchema -> v1 -> save load filters', t => {
// test saved filters
const filtersToSave = vsToSave.filters;
- const expectedSavedFilters = [{
- dataId: [testCsvDataId],
- id: 'hjpn8frza',
- name: ['time'],
- type: 'timeRange',
- value: [1474606800000, 1474617600000],
- enlarged: true,
- plotType: 'histogram',
- yAxis: null
- }, {
- dataId: [testGeoJsonDataId],
- id: 'vpk2466o',
- name: ['RATE'],
- type: 'multiSelect',
- value: ['a'],
- enlarged: false,
- plotType: 'histogram',
- yAxis: null
- }];
+ const expectedSavedFilters = [
+ {
+ dataId: [testCsvDataId],
+ id: 'hjpn8frza',
+ name: ['time'],
+ type: 'timeRange',
+ value: [1474606800000, 1474617600000],
+ enlarged: true,
+ plotType: 'histogram',
+ yAxis: null
+ },
+ {
+ dataId: [testGeoJsonDataId],
+ id: 'vpk2466o',
+ name: ['RATE'],
+ type: 'multiSelect',
+ value: ['a'],
+ enlarged: false,
+ plotType: 'histogram',
+ yAxis: null
+ }
+ ];
cmpFilters(t, expectedSavedFilters, filtersToSave);
cmpFilters(t, expectedSavedFilters, loadedFilters);
@@ -132,16 +131,10 @@ test('#visStateSchema -> v1 -> save load interaction', t => {
tooltip: {
enabled: true,
fieldsToShow: {
- [testCsvDataId]: [
- 'gps_data.utc_timestamp',
- 'gps_data.types',
- 'epoch',
- 'has_result',
- 'id'
- ],
- [testGeoJsonDataId]: [
- 'OBJECTID', 'ZIP_CODE', 'ID', 'TRIPS', 'RATE'
- ]}},
+ [testCsvDataId]: ['gps_data.utc_timestamp', 'gps_data.types', 'epoch', 'has_result', 'id'],
+ [testGeoJsonDataId]: ['OBJECTID', 'ZIP_CODE', 'ID', 'TRIPS', 'RATE']
+ }
+ },
brush: {
enabled: false,
size: 0.5
@@ -179,9 +172,11 @@ test('#visStateSchema -> v1 -> save animation', t => {
// save state
const vsToSave = SchemaManager.getConfigToSave(initialState).config.visState;
- t.deepEqual(Object.keys(vsToSave),
+ t.deepEqual(
+ Object.keys(vsToSave),
['filters', 'layers', 'interactionConfig', 'layerBlending', 'splitMaps', 'animationConfig'],
- 'visState should have all 5 entries');
+ 'visState should have all 5 entries'
+ );
const expectedSavedLayers = [expectedSavedTripLayer];
const expectedAnimationConfig = {currentTime: 1565577261000, speed: 1};
diff --git a/test/node/utils/aggregate-utils-test.js b/test/node/utils/aggregate-utils-test.js
index f3b53e2b0..5bd89723d 100644
--- a/test/node/utils/aggregate-utils-test.js
+++ b/test/node/utils/aggregate-utils-test.js
@@ -19,15 +19,10 @@
// THE SOFTWARE.
import test from 'tape';
-import {
- getFrequency,
- getMode,
- aggregate
-} from 'utils/aggregate-utils';
+import {getFrequency, getMode, aggregate} from 'utils/aggregate-utils';
import {AGGREGATION_TYPES} from 'constants/default-settings';
test('AggregateUtils - GetFrequency', t => {
-
t.deepEqual(
getFrequency([2, 1, 2, 1]),
{
@@ -37,49 +32,27 @@ test('AggregateUtils - GetFrequency', t => {
'Should compute frequency corerctly'
);
- t.deepEqual(
- getFrequency([]),
- {},
- 'Should return an empty object'
- );
+ t.deepEqual(getFrequency([]), {}, 'Should return an empty object');
t.end();
});
test('AggregateUtils - GetMode', t => {
-
- t.deepEqual(
- getMode([2, 1, 2, 1]),
- '1',
- 'should return 1 as Mode'
- );
+ t.deepEqual(getMode([2, 1, 2, 1]), '1', 'should return 1 as Mode');
t.end();
});
test('AggregateUtils - aggregate', t => {
-
const data = [1, 2, 3, 1, 2, 3, 4, 3];
- const results = [
- 8,
- 2.375,
- 4,
- 1,
- 2.5,
- 1.0606601717798212,
- 19,
- 1.125,
- '3',
- 8
- ];
+ const results = [8, 2.375, 4, 1, 2.5, 1.0606601717798212, 19, 1.125, '3', 8];
Object.keys(AGGREGATION_TYPES).map((technique, index) => {
t.equal(
aggregate(data, technique),
results[index],
`Should compute the right aggregation using ${technique} - ${index}`
- )
+ );
});
t.end();
-
});
diff --git a/test/node/utils/color-util-test.js b/test/node/utils/color-util-test.js
index fd0989624..43c40ba80 100644
--- a/test/node/utils/color-util-test.js
+++ b/test/node/utils/color-util-test.js
@@ -22,10 +22,7 @@ import test from 'tape';
import {createLinearGradient} from 'utils/color-utils';
test('createLinearGradient', t => {
-
- let colors = [
- [100, 100, 100]
- ];
+ let colors = [[100, 100, 100]];
t.deepEqual(
createLinearGradient('bottom', colors),
diff --git a/test/node/utils/data-processor-test.js b/test/node/utils/data-processor-test.js
index 0cb7a4ac9..a95413eb0 100644
--- a/test/node/utils/data-processor-test.js
+++ b/test/node/utils/data-processor-test.js
@@ -109,11 +109,7 @@ test('Processor -> getFieldsFromData', t => {
];
fields.forEach((f, i) =>
- t.equal(
- f.type,
- expectedFieldTypes[i],
- `should find field type as ${expectedFieldTypes[i]}`
- )
+ t.equal(f.type, expectedFieldTypes[i], `should find field type as ${expectedFieldTypes[i]}`)
);
t.end();
});
@@ -124,21 +120,13 @@ test('Processor -> processCsvData', t => {
// load sample dataset csv as text
const {fields, rows} = processCsvData(testData);
- t.equal(
- rows.length,
- testAllData.length,
- `should return ${testAllData.length} rows`
- );
+ t.equal(rows.length, testAllData.length, `should return ${testAllData.length} rows`);
t.deepEqual(fields, testFields, 'should parse fields correctly');
t.deepEqual(rows, testAllData, 'should parse rows correctly');
fields.forEach((f, i) => {
- t.deepEqual(
- f,
- testFields[i],
- `should parse correct field ${testFields[i].name}`
- );
+ t.deepEqual(f, testFields[i], `should parse correct field ${testFields[i].name}`);
});
rows.forEach((r, i) => {
@@ -161,14 +149,13 @@ test('Processor -> processCsvData: duplicated field name', t => {
{name: 'column1-1', format: '', tableFieldIndex: 3, type: 'string', analyzerType: 'STRING'},
{name: 'column2', format: '', tableFieldIndex: 4, type: 'string', analyzerType: 'STRING'}
],
- rows: [['a', 'b', 'c', 'd'], ['c', 'd', 'e', 'f']]
+ rows: [
+ ['a', 'b', 'c', 'd'],
+ ['c', 'd', 'e', 'f']
+ ]
};
- t.deepEqual(
- result,
- expectedResult,
- `should return ${testAllData.length} rows`
- );
+ t.deepEqual(result, expectedResult, `should return ${testAllData.length} rows`);
t.end();
});
@@ -178,11 +165,7 @@ test('Processor -> processCsvData -> with nulls', t => {
t.deepEqual(fields, testFields, 'should parse fields correctly');
fields.forEach((f, i) => {
- t.deepEqual(
- f,
- testFields[i],
- `should parse correct field ${testFields[i].name}`
- );
+ t.deepEqual(f, testFields[i], `should parse correct field ${testFields[i].name}`);
});
t.deepEqual(rows, parsedDataWithNulls, 'should parse rows correctly');
@@ -210,7 +193,7 @@ test('Processor => processGeojson', t => {
t.equal(fields.length, geojsonFields.length, 'should have same field length');
fields.forEach((f, i) => {
t.deepEqual(f, geojsonFields[i], 'should format geojson fields');
- })
+ });
t.equal(rows.length, geojsonRows.length, 'should have same row length');
rows.forEach((r, i) => {
@@ -299,11 +282,7 @@ test('Processor => processGeojson: parse rows', t => {
];
const result = processGeojson(testGeoData);
- t.deepEqual(
- Object.keys(result),
- ['fields', 'rows'],
- 'should contain fields and rows'
- );
+ t.deepEqual(Object.keys(result), ['fields', 'rows'], 'should contain fields and rows');
t.deepEqual(
result.fields,
expectedFields,
@@ -334,16 +313,7 @@ test('Processor -> parseCsvRowsByFieldType -> real', t => {
[' 1.55e+3 xyz']
];
- const expected = [
- [0.0],
- [1.0],
- [-1.0],
- [155.0],
- [1550.0],
- [0.00155],
- [0.00155],
- [1550.0]
- ];
+ const expected = [[0.0], [1.0], [-1.0], [155.0], [1550.0], [0.00155], [0.00155], [1550.0]];
parseCsvRowsByFieldType(rows, -1, field, 0);
t.same(rows, expected, 'should parsed reals properly');
@@ -369,28 +339,10 @@ test('Processor -> parseCsvRowsByFieldType -> boolean', t => {
type: ALL_FIELD_TYPES.boolean
};
- const rows = [
- [null],
- ['0'],
- ['1'],
- ['True'],
- ['False'],
- ['0'],
- ['1'],
- ['true']
- ];
+ const rows = [[null], ['0'], ['1'], ['True'], ['False'], ['0'], ['1'], ['true']];
// is parsing '' meaningful, why not false
- const expected = [
- [null],
- [false],
- [true],
- [true],
- [false],
- [false],
- [true],
- [true]
- ];
+ const expected = [[null], [false], [true], [true], [false], [false], [true], [true]];
parseCsvRowsByFieldType(rows, -1, field, 0);
t.same(rows, expected, 'should parsed boolean properly');
@@ -452,11 +404,7 @@ test('Processor -> getSampleForTypeAnalyze', t => {
test('Processor -> validateInputData', t => {
t.equal(validateInputData(null), null, 'Should throw error if data is null');
- t.equal(
- validateInputData({rows: 'hello'}),
- null,
- 'Should throw error if data.rows is null'
- );
+ t.equal(validateInputData({rows: 'hello'}), null, 'Should throw error if data.rows is null');
t.equal(
validateInputData({rows: [], fields: null}),
null,
@@ -493,27 +441,24 @@ test('Processor -> validateInputData', t => {
},
expected: {
rows: [[1], [2], [3]],
- fields: [{
- type: ALL_FIELD_TYPES.integer, format: '', name: 'taro', analyzerType: 'INT'
- }]
+ fields: [
+ {
+ type: ALL_FIELD_TYPES.integer,
+ format: '',
+ name: 'taro',
+ analyzerType: 'INT'
+ }
+ ]
},
msg: 'should reassign field type'
},
{
input: {
- rows: [
- ['2018-09-01 00:00'],
- ['2018-09-01 01:00'],
- ['2018-09-01 02:00']
- ],
+ rows: [['2018-09-01 00:00'], ['2018-09-01 01:00'], ['2018-09-01 02:00']],
fields: [{type: ALL_FIELD_TYPES.timestamp, format: '', name: 'taro'}]
},
expected: {
- rows: [
- ['2018-09-01 00:00'],
- ['2018-09-01 01:00'],
- ['2018-09-01 02:00']
- ],
+ rows: [['2018-09-01 00:00'], ['2018-09-01 01:00'], ['2018-09-01 02:00']],
fields: [
{
type: ALL_FIELD_TYPES.timestamp,
@@ -535,11 +480,7 @@ test('Processor -> validateInputData', t => {
});
test('Processor -> processRowObject', t => {
- t.equal(
- processRowObject({}),
- null,
- 'Should return null when rawData is empty'
- );
+ t.equal(processRowObject({}), null, 'Should return null when rawData is empty');
const cases = [
{
input: [
@@ -548,7 +489,11 @@ test('Processor -> processRowObject', t => {
{a: 3, b: 'd', c: true, d: '1.4'}
],
expected: {
- rows: [[1, 'c', true, 1.2], [2, 'c', false, 1.3], [3, 'd', true, 1.4]],
+ rows: [
+ [1, 'c', true, 1.2],
+ [2, 'c', false, 1.3],
+ [3, 'd', true, 1.4]
+ ],
fields: [
{
name: 'a',
@@ -657,10 +602,7 @@ test('Processor -> analyzerTypeToFieldType', t => {
t.ok(spy.calledOnce, `should warn when pass unrecognized type ${atype}`);
} else {
const fieldType = analyzerTypeToFieldType(atype);
- t.ok(
- ALL_FIELD_TYPES[fieldType],
- `should assign ${atype} to one of ALL_FIELD_TYPES`
- );
+ t.ok(ALL_FIELD_TYPES[fieldType], `should assign ${atype} to one of ALL_FIELD_TYPES`);
}
spy.restore();
diff --git a/test/node/utils/data-scale-utils-test.js b/test/node/utils/data-scale-utils-test.js
index 6cef5437a..c24b18d72 100644
--- a/test/node/utils/data-scale-utils-test.js
+++ b/test/node/utils/data-scale-utils-test.js
@@ -31,7 +31,6 @@ function numberSort(a, b) {
}
test('DataScaleUtils -> getOrdinalDomain', t => {
-
const data = ['a', 'a', 'b', undefined, null, 0];
function valueAccessor(d) {
return d.value;
@@ -39,17 +38,18 @@ test('DataScaleUtils -> getOrdinalDomain', t => {
const values = [{value: 'a'}, {value: 'b'}, {value: 'b'}];
- t.deepEqual(getOrdinalDomain(data), [0, 'a', 'b'],
- 'should get correct ordinal domain');
+ t.deepEqual(getOrdinalDomain(data), [0, 'a', 'b'], 'should get correct ordinal domain');
- t.deepEqual(getOrdinalDomain(values, valueAccessor), ['a', 'b'],
- 'should get correct ordinal domain');
+ t.deepEqual(
+ getOrdinalDomain(values, valueAccessor),
+ ['a', 'b'],
+ 'should get correct ordinal domain'
+ );
t.end();
});
test('DataScaleUtils -> getQuantileDomain', t => {
-
const data = ['a', 'b', 'c', 'b', undefined, null];
const quanData = [1, 4, 2, 3, 1, undefined, null, 0];
function valueAccessor(d) {
@@ -58,20 +58,28 @@ test('DataScaleUtils -> getQuantileDomain', t => {
const values = [{value: 'a'}, {value: 'b'}, {value: 'b'}];
- t.deepEqual(getQuantileDomain(data, undefined, undefined),
- ['a', 'b', 'b', 'c'], 'should get correct quantile domain');
+ t.deepEqual(
+ getQuantileDomain(data, undefined, undefined),
+ ['a', 'b', 'b', 'c'],
+ 'should get correct quantile domain'
+ );
- t.deepEqual(getQuantileDomain(quanData, undefined, numberSort),
- [0, 1, 1, 2, 3, 4], 'should get correct quantile domain');
+ t.deepEqual(
+ getQuantileDomain(quanData, undefined, numberSort),
+ [0, 1, 1, 2, 3, 4],
+ 'should get correct quantile domain'
+ );
- t.deepEqual(getQuantileDomain(values, valueAccessor), ['a', 'b', 'b'],
- 'should get correct quantile domain');
+ t.deepEqual(
+ getQuantileDomain(values, valueAccessor),
+ ['a', 'b', 'b'],
+ 'should get correct quantile domain'
+ );
t.end();
});
test('DataScaleUtils -> getLinearDomain', t => {
-
const quanData = [1, 4, 2, 3, 1, undefined, null, 0];
function valueAccessor(d) {
return d.value;
@@ -79,20 +87,19 @@ test('DataScaleUtils -> getLinearDomain', t => {
const values = [{value: 1}, {value: 0}, {value: -3}];
- t.deepEqual(getLinearDomain(quanData, undefined),
- [0, 4], 'should get correct Linear domain');
+ t.deepEqual(getLinearDomain(quanData, undefined), [0, 4], 'should get correct Linear domain');
- t.deepEqual(getLinearDomain([10, 10]),
- [10, 10], 'should get correct Linear domain');
+ t.deepEqual(getLinearDomain([10, 10]), [10, 10], 'should get correct Linear domain');
- t.deepEqual(getLinearDomain([10, undefined]),
- [10, 10], 'should get correct Linear domain');
+ t.deepEqual(getLinearDomain([10, undefined]), [10, 10], 'should get correct Linear domain');
- t.deepEqual(getLinearDomain([undefined, undefined, null]),
- [0, 1], 'should get correct Linear domain');
+ t.deepEqual(
+ getLinearDomain([undefined, undefined, null]),
+ [0, 1],
+ 'should get correct Linear domain'
+ );
- t.deepEqual(getLinearDomain(values, valueAccessor), [-3, 1],
- 'should get correct Linear domain');
+ t.deepEqual(getLinearDomain(values, valueAccessor), [-3, 1], 'should get correct Linear domain');
t.end();
});
@@ -102,14 +109,23 @@ test('DataScaleUtils -> getLogDomain', t => {
return d.value;
}
- t.deepEqual(getLogDomain([{value: 1}, {value: 0}, {value: -3}], valueAccessor), [-3, 1],
- 'should get correct Log domain with negative numbers');
+ t.deepEqual(
+ getLogDomain([{value: 1}, {value: 0}, {value: -3}], valueAccessor),
+ [-3, 1],
+ 'should get correct Log domain with negative numbers'
+ );
- t.deepEqual(getLogDomain([{value: 1}, {value: 0}, {value: 3}], valueAccessor), [0.00001, 3],
- 'should not contain a 0 in domain');
+ t.deepEqual(
+ getLogDomain([{value: 1}, {value: 0}, {value: 3}], valueAccessor),
+ [0.00001, 3],
+ 'should not contain a 0 in domain'
+ );
- t.deepEqual(getLogDomain([], valueAccessor), [0.00001, 1],
- 'should have undefined domain for empty set');
+ t.deepEqual(
+ getLogDomain([], valueAccessor),
+ [0.00001, 1],
+ 'should have undefined domain for empty set'
+ );
t.end();
-})
+});
diff --git a/test/node/utils/data-utils-test.js b/test/node/utils/data-utils-test.js
index ac8f474c2..dfa9ff561 100644
--- a/test/node/utils/data-utils-test.js
+++ b/test/node/utils/data-utils-test.js
@@ -20,61 +20,41 @@
import test from 'tape';
-import {
- getRoundingDecimalFromStep,
- preciseRound,
- roundValToStep
-} from 'utils/data-utils';
+import {getRoundingDecimalFromStep, preciseRound, roundValToStep} from 'utils/data-utils';
test('dataUtils -> preciseRound', t => {
-
t.equal(preciseRound(1.234, 2), '1.23', 'should round 1.234 correctly');
t.equal(preciseRound(13.234, 0), '13', 'should round 13.234 correctly');
t.equal(preciseRound(13, 2), '13.00', 'should round 13 correctly');
t.equal(preciseRound(1.437, 2), '1.44', 'should round 1.437 correctly');
- t.equal(preciseRound(0.09999999999999987, 8), '0.10000000',
- 'should round 0.10000000 correctly');
+ t.equal(preciseRound(0.09999999999999987, 8), '0.10000000', 'should round 0.10000000 correctly');
t.end();
});
test('dataUtils -> getRoundingDecimalFromStep', t => {
-
t.equal(getRoundingDecimalFromStep(1), 0, 'decimal of step=int should be 0');
- t.equal(getRoundingDecimalFromStep(0.1), 1,
- 'decimal of step=0.1 should be 1');
- t.equal(getRoundingDecimalFromStep(0.01), 2,
- 'decimal of step=0.01 should be 2');
- t.equal(getRoundingDecimalFromStep(0.2), 1,
- 'decimal of step=0.2 should be 1');
- t.equal(getRoundingDecimalFromStep(0.001), 3,
- 'decimal of step=0.001 should be 3');
- t.equal(getRoundingDecimalFromStep(10), 0,
- 'decimal of step=10 should be 0');
- t.equal(getRoundingDecimalFromStep(0.5), 1,
- 'decimal of step=0.5 should be 0');
- t.equal(getRoundingDecimalFromStep(1.5), 1,
- 'decimal of step=1.5 should be 1');
+ t.equal(getRoundingDecimalFromStep(0.1), 1, 'decimal of step=0.1 should be 1');
+ t.equal(getRoundingDecimalFromStep(0.01), 2, 'decimal of step=0.01 should be 2');
+ t.equal(getRoundingDecimalFromStep(0.2), 1, 'decimal of step=0.2 should be 1');
+ t.equal(getRoundingDecimalFromStep(0.001), 3, 'decimal of step=0.001 should be 3');
+ t.equal(getRoundingDecimalFromStep(10), 0, 'decimal of step=10 should be 0');
+ t.equal(getRoundingDecimalFromStep(0.5), 1, 'decimal of step=0.5 should be 0');
+ t.equal(getRoundingDecimalFromStep(1.5), 1, 'decimal of step=1.5 should be 1');
t.end();
-
});
test('dataUtils -> getRoundingDecimalFromStep', t => {
-
t.equal(roundValToStep(0, 0.1, 0.11), 0.1, 'should round 0.11 to 0.1');
t.equal(roundValToStep(0, 0.1, 0.1), 0.1, 'should round 0.1 to 0.1');
t.equal(roundValToStep(1, 0.1, 1.16), 1.2, 'should round 1.16 to 1.2');
t.equal(roundValToStep(1, 1, 1.6), 2, 'should round 1.6 to 2');
t.equal(roundValToStep(1, 1, 1.32), 1, 'should round 1.32 to 1');
t.equal(roundValToStep(1, 0.01, 1.435), 1.44, 'should round 1.435 to 1.44');
- t.equal(roundValToStep(1, 0.001, 1.4357), 1.436,
- 'should round 1.4357 to 1.436');
+ t.equal(roundValToStep(1, 0.001, 1.4357), 1.436, 'should round 1.4357 to 1.436');
t.equal(roundValToStep(0, 0.2, 1.5), 1.6, 'should round 1.5 to 1.6');
t.equal(roundValToStep(0, 0.5, 20.25), 20.5, 'should round 20.25 to 20.5');
t.equal(roundValToStep(0.3, 0.3, 12.77), 12.9, 'should round 12.77 to 12.9');
- t.equal(roundValToStep(-13, 0.1, -10.77), -10.8,
- 'should round -10.77 to -10.8');
- t.equal(roundValToStep(-30, 1, -14.5), -14,
- 'should round -14.5 to -14');
+ t.equal(roundValToStep(-13, 0.1, -10.77), -10.8, 'should round -10.77 to -10.8');
+ t.equal(roundValToStep(-30, 1, -14.5), -14, 'should round -14.5 to -14');
t.end();
-
});
diff --git a/test/node/utils/filter-utils-test.js b/test/node/utils/filter-utils-test.js
index ff3f086d1..d2372950c 100644
--- a/test/node/utils/filter-utils-test.js
+++ b/test/node/utils/filter-utils-test.js
@@ -56,10 +56,7 @@ function testGetTimeFieldDomain(rows, allFields, t) {
{
name: 'epoch',
input: getFieldDomain(rows, allFields[4]).domain,
- output: [
- moment.utc(1472688000000).valueOf(),
- moment.utc(1472774400000).valueOf()
- ],
+ output: [moment.utc(1472688000000).valueOf(), moment.utc(1472774400000).valueOf()],
msg: 1472688000000
},
{
@@ -92,11 +89,7 @@ function testGetTimeFieldDomain(rows, allFields, t) {
];
test_cases.forEach(tc =>
- t.deepEqual(
- tc.input,
- tc.output,
- `should process correct domain for timestamp ${tc.msg}`
- )
+ t.deepEqual(tc.input, tc.output, `should process correct domain for timestamp ${tc.msg}`)
);
}
@@ -115,56 +108,27 @@ function testGetFilterFunction(rows, fields, t) {
let field = fields[timeStringFilter.fieldIdx[0]];
- let filterFunction = getFilterFunction(
- field,
- dataId,
- timeStringFilter,
- []
- );
+ let filterFunction = getFilterFunction(field, dataId, timeStringFilter, []);
- t.equal(
- filterFunction(rows[10], 10),
- true,
- `${rows[10][0]} should be inside the range`
- );
+ t.equal(filterFunction(rows[10], 10), true, `${rows[10][0]} should be inside the range`);
- t.equal(
- filterFunction(rows[15], 15),
- false,
- `${rows[15][0]} should be outside the range`
- );
+ t.equal(filterFunction(rows[15], 15), false, `${rows[15][0]} should be outside the range`);
const epochFilter = {
fieldIdx: [4],
type: FILTER_TYPES.timeRange,
- value: [
- moment.utc(1472688000000).valueOf(),
- moment.utc(1472734400000).valueOf()
- ],
+ value: [moment.utc(1472688000000).valueOf(), moment.utc(1472734400000).valueOf()],
id: 'filter-2',
dataId: [dataId]
};
field = fields[epochFilter.fieldIdx[0]];
- filterFunction = getFilterFunction(
- field,
- dataId,
- epochFilter,
- []
- );
+ filterFunction = getFilterFunction(field, dataId, epochFilter, []);
- t.equal(
- filterFunction(rows[10], 10),
- true,
- `${rows[10][1]} should be inside the range`
- );
+ t.equal(filterFunction(rows[10], 10), true, `${rows[10][1]} should be inside the range`);
- t.equal(
- filterFunction(rows[15], 15),
- false,
- `${rows[15][1]} should be outside the range`
- );
+ t.equal(filterFunction(rows[15], 15), false, `${rows[15][1]} should be outside the range`);
const tzFilter = {
fieldIdx: [7],
@@ -179,24 +143,11 @@ function testGetFilterFunction(rows, fields, t) {
field = fields[tzFilter.fieldIdx[0]];
- filterFunction = getFilterFunction(
- field,
- dataId,
- tzFilter,
- []
- );
+ filterFunction = getFilterFunction(field, dataId, tzFilter, []);
- t.equal(
- filterFunction(rows[10], 10),
- true,
- `${rows[10][7]} should be inside the range`
- );
+ t.equal(filterFunction(rows[10], 10), true, `${rows[10][7]} should be inside the range`);
- t.equal(
- filterFunction(rows[23], 10),
- false,
- `${rows[23][7]} should be outside the range`
- );
+ t.equal(filterFunction(rows[23], 10), false, `${rows[23][7]} should be outside the range`);
const utcFilter = {
fieldIdx: [8],
@@ -211,30 +162,13 @@ function testGetFilterFunction(rows, fields, t) {
field = fields[utcFilter.fieldIdx[0]];
- filterFunction = getFilterFunction(
- field,
- dataId,
- utcFilter,
- []
- );
+ filterFunction = getFilterFunction(field, dataId, utcFilter, []);
- t.equal(
- filterFunction(rows[6], 6),
- false,
- `${rows[0][8]} should be outside the range`
- );
+ t.equal(filterFunction(rows[6], 6), false, `${rows[0][8]} should be outside the range`);
- t.equal(
- filterFunction(rows[4], 4),
- true,
- `${rows[4][8]} should be inside the range`
- );
+ t.equal(filterFunction(rows[4], 4), true, `${rows[4][8]} should be inside the range`);
- t.equal(
- filterFunction(rows[23], 23),
- false,
- `${rows[23][8]} should be outside the range`
- );
+ t.equal(filterFunction(rows[23], 23), false, `${rows[23][8]} should be outside the range`);
}
/* eslint-disable max-statements */
@@ -380,11 +314,7 @@ test('filterUtils -> getTimestampFieldDomain', t => {
}
},
tiny: {
- input: [
- '2016-10-01 09:45:39.001',
- '2016-10-01 09:45:39.002',
- '2016-10-01 09:45:39.003'
- ],
+ input: ['2016-10-01 09:45:39.001', '2016-10-01 09:45:39.002', '2016-10-01 09:45:39.003'],
expect: {
domain: [1475315139001, 1475315139003],
mappedValue: [1475315139001, 1475315139002, 1475315139003],
@@ -396,11 +326,7 @@ test('filterUtils -> getTimestampFieldDomain', t => {
}
},
small: {
- input: [
- '2016-10-01 09:45:39.010',
- '2016-10-01 09:45:39.020',
- '2016-10-01 09:45:39.030'
- ],
+ input: ['2016-10-01 09:45:39.010', '2016-10-01 09:45:39.020', '2016-10-01 09:45:39.030'],
expect: {
domain: [1475315139010, 1475315139030],
mappedValue: [1475315139010, 1475315139020, 1475315139030],
@@ -410,11 +336,7 @@ test('filterUtils -> getTimestampFieldDomain', t => {
}
},
medium: {
- input: [
- '2016-10-01 09:45:39.100',
- '2016-10-01 09:45:39.200',
- '2016-10-01 09:45:39.300'
- ],
+ input: ['2016-10-01 09:45:39.100', '2016-10-01 09:45:39.200', '2016-10-01 09:45:39.300'],
expect: {
domain: [1475315139100, 1475315139300],
mappedValue: [1475315139100, 1475315139200, 1475315139300],
@@ -436,10 +358,7 @@ test('filterUtils -> getTimestampFieldDomain', t => {
};
Object.keys(timeData).forEach(key => {
- const tsFieldDomain = getTimestampFieldDomain(
- timeData[key].input,
- valueAccessor
- );
+ const tsFieldDomain = getTimestampFieldDomain(timeData[key].input, valueAccessor);
t.deepEqual(
Object.keys(tsFieldDomain).sort(),
Object.keys(timeData[key].expect).sort(),
@@ -471,39 +390,23 @@ test('filterUtils -> getDatasetFieldIndexForFilter', t => {
fieldIdx: [3]
});
- t.equal(
- fieldIndex,
- 3,
- 'FieldIndex should be 3'
- );
+ t.equal(fieldIndex, 3, 'FieldIndex should be 3');
fieldIndex = getDatasetFieldIndexForFilter(dataId, {
dataId: ['different-id', dataId],
fieldIdx: [3, 5]
});
- t.equal(
- fieldIndex,
- 5,
- 'FieldIndex should be 5'
- );
+ t.equal(fieldIndex, 5, 'FieldIndex should be 5');
fieldIndex = getDatasetFieldIndexForFilter(dataId, {dataId: ['different-id']});
- t.equal(
- fieldIndex,
- -1,
- 'FieldIndex should be -1'
- );
+ t.equal(fieldIndex, -1, 'FieldIndex should be -1');
t.end();
});
test('filterUtils -> isValidFilterValue', t => {
- t.equal(
- isValidFilterValue(null, true),
- false,
- 'Should return false because type is null'
- );
+ t.equal(isValidFilterValue(null, true), false, 'Should return false because type is null');
t.equal(
isValidFilterValue(FILTER_TYPES.select, true),
@@ -558,103 +461,67 @@ test('filterUtils -> isValidFilterValue', t => {
test('filterUtils -> isInPolygon', t => {
t.equal(
- isInPolygon(
- [120.47448, 23.667604],
- {
- type: 'Feature',
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [
- 120.21949418752885,
- 23.755486652156186
- ],
- [
- 120.21949418752885,
- 23.221461105318184
- ],
- [
- 121.05994828909135,
- 23.221461105318184
- ],
- [
- 121.05994828909135,
- 23.755486652156186
- ],
- [
- 120.21949418752885,
- 23.755486652156186
- ]
- ]
+ isInPolygon([120.47448, 23.667604], {
+ type: 'Feature',
+ geometry: {
+ type: 'Polygon',
+ coordinates: [
+ [
+ [120.21949418752885, 23.755486652156186],
+ [120.21949418752885, 23.221461105318184],
+ [121.05994828909135, 23.221461105318184],
+ [121.05994828909135, 23.755486652156186],
+ [120.21949418752885, 23.755486652156186]
]
+ ]
+ },
+ properties: {
+ renderType: 'Rectangle',
+ isClosed: true,
+ bbox: {
+ xmin: 120.21949418752885,
+ xmax: null,
+ ymin: 23.755486652156186,
+ ymax: null
},
- properties: {
- renderType: 'Rectangle',
- isClosed: true,
- bbox: {
- xmin: 120.21949418752885,
- xmax: null,
- ymin: 23.755486652156186,
- ymax: null
- },
- isVisible: true,
- filterId: 'z1ilfjv6'
- },
- id: '036d9e21-af6b-4350-aab9-f1ce37c35cce'
- }
- ),
+ isVisible: true,
+ filterId: 'z1ilfjv6'
+ },
+ id: '036d9e21-af6b-4350-aab9-f1ce37c35cce'
+ }),
true,
'Should return true because the point is within the polygon'
);
t.equal(
- isInPolygon(
- [119.47448, 23.667604],
- {
- type: 'Feature',
- geometry: {
- type: 'Polygon',
- coordinates: [
- [
- [
- 120.21949418752885,
- 23.755486652156186
- ],
- [
- 120.21949418752885,
- 23.221461105318184
- ],
- [
- 121.05994828909135,
- 23.221461105318184
- ],
- [
- 121.05994828909135,
- 23.755486652156186
- ],
- [
- 120.21949418752885,
- 23.755486652156186
- ]
- ]
+ isInPolygon([119.47448, 23.667604], {
+ type: 'Feature',
+ geometry: {
+ type: 'Polygon',
+ coordinates: [
+ [
+ [120.21949418752885, 23.755486652156186],
+ [120.21949418752885, 23.221461105318184],
+ [121.05994828909135, 23.221461105318184],
+ [121.05994828909135, 23.755486652156186],
+ [120.21949418752885, 23.755486652156186]
]
+ ]
+ },
+ properties: {
+ renderType: 'Rectangle',
+ isClosed: true,
+ bbox: {
+ xmin: 120.21949418752885,
+ xmax: null,
+ ymin: 23.755486652156186,
+ ymax: null
},
- properties: {
- renderType: 'Rectangle',
- isClosed: true,
- bbox: {
- xmin: 120.21949418752885,
- xmax: null,
- ymin: 23.755486652156186,
- ymax: null
- },
- isVisible: true,
- filterId: 'z1ilfjv6'
- },
- id: '036d9e21-af6b-4350-aab9-f1ce37c35cce'
- }
- ),
+ isVisible: true,
+ filterId: 'z1ilfjv6'
+ },
+ id: '036d9e21-af6b-4350-aab9-f1ce37c35cce'
+ }),
false,
'Should return false because the point is not within the polygon'
);
@@ -679,9 +546,11 @@ test('filterUtils -> validatePolygonFilter', t => {
id: 'puppy'
};
- const layers = [{
- id: 'layer1'
- }];
+ const layers = [
+ {
+ id: 'layer1'
+ }
+ ];
t.deepEqual(
validatePolygonFilter(dataset, filter, layers).filter,
@@ -706,21 +575,29 @@ test('filterUtils -> validatePolygonFilter', t => {
);
t.deepEqual(
- validatePolygonFilter(dataset, {
- ...filter,
- dataId: ['non_valid']
- }, layers).filter,
+ validatePolygonFilter(
+ dataset,
+ {
+ ...filter,
+ dataId: ['non_valid']
+ },
+ layers
+ ).filter,
null,
'Should not validate filter with non existing dataId'
);
t.deepEqual(
- validatePolygonFilter(dataset, {
- ...filter,
- value: {
- id: 'wrong-value-for-polygon-type'
- }
- }, layers).filter,
+ validatePolygonFilter(
+ dataset,
+ {
+ ...filter,
+ value: {
+ id: 'wrong-value-for-polygon-type'
+ }
+ },
+ layers
+ ).filter,
null,
'Should not validate filter given type and value without corresponding layer'
);
@@ -729,7 +606,6 @@ test('filterUtils -> validatePolygonFilter', t => {
});
test('filterUtils -> Polygon getFilterFunction ', t => {
-
const dataset = {
id: 'puppy',
data: mockPolygonData.data,
@@ -741,25 +617,11 @@ test('filterUtils -> Polygon getFilterFunction ', t => {
const polygonFilter = generatePolygonFilter(layers, mockPolygonFeature);
- let filterFunction = getFilterFunction(
- null,
- dataset.id,
- polygonFilter,
- []
- );
+ let filterFunction = getFilterFunction(null, dataset.id, polygonFilter, []);
- t.equal(
- filterFunction(data[0], 0),
- true,
- `Should return true because layer list is empty`
- );
+ t.equal(filterFunction(data[0], 0), true, `Should return true because layer list is empty`);
- filterFunction = getFilterFunction(
- null,
- 'puppy-2',
- polygonFilter,
- layers
- );
+ filterFunction = getFilterFunction(null, 'puppy-2', polygonFilter, layers);
t.equal(
filterFunction(data[0], 0),
diff --git a/test/node/utils/gpu-filter-utils-test.js b/test/node/utils/gpu-filter-utils-test.js
index 5224f8af2..3cd310989 100644
--- a/test/node/utils/gpu-filter-utils-test.js
+++ b/test/node/utils/gpu-filter-utils-test.js
@@ -189,11 +189,7 @@ test('gpuFilterUtils -> assignGpuChannels', t => {
];
testCases.forEach(tc => {
- t.deepEqual(
- assignGpuChannels(tc.filters),
- tc.result,
- 'should assign correct channel'
- );
+ t.deepEqual(assignGpuChannels(tc.filters), tc.result, 'should assign correct channel');
});
t.end();
});
@@ -206,29 +202,17 @@ test('gpuFilterUtils -> getDatasetFieldIndexForFilter', t => {
fieldIdx: [3]
});
- t.equal(
- fieldIndex,
- 3,
- 'FieldIndex should be 3'
- );
+ t.equal(fieldIndex, 3, 'FieldIndex should be 3');
fieldIndex = getDatasetFieldIndexForFilter(dataId, {
dataId: ['different-id', dataId],
fieldIdx: [3, 5]
});
- t.equal(
- fieldIndex,
- 5,
- 'FieldIndex should be 5'
- );
+ t.equal(fieldIndex, 5, 'FieldIndex should be 5');
fieldIndex = getDatasetFieldIndexForFilter(dataId, {dataId: ['different-id']});
- t.equal(
- fieldIndex,
- -1,
- 'FieldIndex should be -1'
- );
+ t.equal(fieldIndex, -1, 'FieldIndex should be -1');
t.end();
});
diff --git a/test/node/utils/layer-utils-test.js b/test/node/utils/layer-utils-test.js
index cbc592688..96be72e2f 100644
--- a/test/node/utils/layer-utils-test.js
+++ b/test/node/utils/layer-utils-test.js
@@ -239,10 +239,7 @@ test('layerUtils -> findDefaultLayer.1', t => {
];
const fieldPairs = findPointFieldPairs(inputFields);
- const layers = findDefaultLayer(
- {fields: inputFields, fieldPairs, id: dataId},
- LayerClasses
- );
+ const layers = findDefaultLayer({fields: inputFields, fieldPairs, id: dataId}, LayerClasses);
t.equal(layers.length, outputLayers.length, 'number of layers found');
@@ -346,10 +343,7 @@ test('layerUtils -> findDefaultLayer.3', t => {
];
const fieldPairs = findPointFieldPairs(inputFields);
- const layers = findDefaultLayer(
- {fields: inputFields, fieldPairs, id: dataId},
- KeplerGlLayers
- );
+ const layers = findDefaultLayer({fields: inputFields, fieldPairs, id: dataId}, KeplerGlLayers);
t.equal(layers.length, 1, 'number of layers found');
layers.forEach((l, i) => cmpLayers(t, outputLayers[i], l));
@@ -472,10 +466,7 @@ test('layerUtils -> findDefaultLayer.4', t => {
];
const fieldPairs = findPointFieldPairs(inputFields);
- const layers = findDefaultLayer(
- {fields: inputFields, fieldPairs, id: dataId},
- KeplerGlLayers
- );
+ const layers = findDefaultLayer({fields: inputFields, fieldPairs, id: dataId}, KeplerGlLayers);
t.equal(layers.length, outputLayers.length, 'number of layers found');
layers.forEach((l, i) => cmpLayers(t, outputLayers[i], l));
@@ -497,10 +488,7 @@ test('layerUtils -> findDefaultLayer.5', t => {
];
const fieldPairs = findPointFieldPairs(inputFields);
- const layers = findDefaultLayer(
- {fields: inputFields, fieldPairs, id: 'yo'},
- KeplerGlLayers
- );
+ const layers = findDefaultLayer({fields: inputFields, fieldPairs, id: 'yo'}, KeplerGlLayers);
t.equal(layers.length, 0, 'number of layers found');
@@ -551,6 +539,7 @@ test('layerUtils -> findDefaultLayer:GeojsonLayer', t => {
}
});
+ // eslint-disable-next-line no-unused-vars
const [layer1Color, layer2Color, layer2Stroke] = getNextColorMakerValue(3);
expected1.updateLayerVisConfig({filled: true, stroked: false});
expected2.updateLayerVisConfig({
@@ -613,12 +602,9 @@ test('layerUtils -> findDefaultLayer:GeojsonLayer.wkt', t => {
geojson: {value: 'simplified_shape', fieldIdx: 2}
}
});
- const [
- layer1Color,
- strokeColor1,
- layer2Color,
- strokeColor2
- ] = getNextColorMakerValue(4);
+
+ // eslint-disable-next-line no-unused-vars
+ const [layer1Color, strokeColor1, layer2Color, strokeColor2] = getNextColorMakerValue(4);
expected1.updateLayerVisConfig({
filled: true,
stroked: true,
@@ -741,17 +727,9 @@ test('layerUtils -> findDefaultLayer: TripLayer', t => {
'should set correct animation domain'
);
- t.deepEqual(
- foundLayer.meta.bounds,
- tripBounds,
- 'should set correct bounds'
- );
+ t.deepEqual(foundLayer.meta.bounds, tripBounds, 'should set correct bounds');
- t.deepEqual(
- foundLayer.meta.featureTypes,
- {line: true},
- 'should set correct bounds'
- );
+ t.deepEqual(foundLayer.meta.featureTypes, {line: true}, 'should set correct bounds');
t.end();
});
@@ -762,7 +740,7 @@ test('layerUtils -> findDefaultLayer: TripLayer.1 -> no ts', t => {
...f,
geometry: {
...f.geometry,
- coordinates: f.geometry.coordinates.map(coord => ([...coord.slice(0, 3), 'hello']))
+ coordinates: f.geometry.coordinates.map(coord => [...coord.slice(0, 3), 'hello'])
}
}));
@@ -776,10 +754,7 @@ test('layerUtils -> findDefaultLayer: TripLayer.1 -> no ts', t => {
data: processGeojson(noTripGeojson)
});
- const layers = findDefaultLayer(
- dataset.taro,
- LayerClasses
- );
+ const layers = findDefaultLayer(dataset.taro, LayerClasses);
t.equal(layers.length, 1, 'should find 1 layer');
const foundLayer = layers[0];
@@ -811,10 +786,7 @@ test('layerUtils -> findDefaultLayer: TripLayer.1 -> ts as string', t => {
data: processGeojson(tripData)
});
- const layers = findDefaultLayer(
- dataset.taro,
- LayerClasses
- );
+ const layers = findDefaultLayer(dataset.taro, LayerClasses);
t.equal(layers.length, 1, 'should find 1 layer');
const foundLayer = layers[0];
diff --git a/test/node/utils/notifications-utils-test.js b/test/node/utils/notifications-utils-test.js
index 2e7a3ffb9..cb5d24016 100644
--- a/test/node/utils/notifications-utils-test.js
+++ b/test/node/utils/notifications-utils-test.js
@@ -24,12 +24,16 @@ import {errorNotification, successNotification} from 'utils/notifications-utils'
test('#notificationsUtils -> errorNotification', t => {
const notification = errorNotification({message: 'test', id: 'test-1'});
- t.deepEqual(notification, {
- id: 'test-1',
- message: 'test',
- type: 'error',
- topic: 'global'
- }, 'ErrorNotification creates an error notification');
+ t.deepEqual(
+ notification,
+ {
+ id: 'test-1',
+ message: 'test',
+ type: 'error',
+ topic: 'global'
+ },
+ 'ErrorNotification creates an error notification'
+ );
t.end();
});
@@ -37,12 +41,16 @@ test('#notificationsUtils -> errorNotification', t => {
test('#notificationsUtils -> successNotification', t => {
const notification = successNotification({message: 'test', id: 'test-1'});
- t.deepEqual(notification, {
- id: 'test-1',
- message: 'test',
- type: 'success',
- topic: 'global'
- }, 'SuccessNotification creates an error notification');
+ t.deepEqual(
+ notification,
+ {
+ id: 'test-1',
+ message: 'test',
+ type: 'success',
+ topic: 'global'
+ },
+ 'SuccessNotification creates an error notification'
+ );
t.end();
});
diff --git a/test/node/utils/util-test.js b/test/node/utils/util-test.js
index f136cd861..d8004f8a2 100644
--- a/test/node/utils/util-test.js
+++ b/test/node/utils/util-test.js
@@ -28,36 +28,28 @@ test('Utils -> set', t => {
t.notLooseEqual(obj1, obj2, 'set should create a new object');
t.equal(set(['map'], 'hello', null), null, 'set null should return null');
t.equal(set(['map'], 'hello', undefined), undefined, 'set undefined should return undefined');
- t.deepEqual(set(['map', 'map1'], 'hello', {map: {map1: 'world'}}), {map: {map1: 'hello'}}, 'set should set value');
+ t.deepEqual(
+ set(['map', 'map1'], 'hello', {map: {map1: 'world'}}),
+ {map: {map1: 'hello'}},
+ 'set should set value'
+ );
t.deepEqual(set(['map'], 'hello', {}), {map: 'hello'}, 'set should create leave node');
- t.deepEqual(set(['map', 1], 'hello', {map: ['hello', 'world']}), {map: ['hello', 'hello']}, 'set should work with array');
+ t.deepEqual(
+ set(['map', 1], 'hello', {map: ['hello', 'world']}),
+ {map: ['hello', 'hello']},
+ 'set should work with array'
+ );
t.end();
});
test('Utils -> toArray', t => {
- t.deepEqual(
- toArray(),
- [],
- 'Should return an empty array for undefined value'
- );
+ t.deepEqual(toArray(), [], 'Should return an empty array for undefined value');
- t.deepEqual(
- toArray([1, 2]),
- [1, 2],
- 'Should not change an existing array'
- );
+ t.deepEqual(toArray([1, 2]), [1, 2], 'Should not change an existing array');
- t.deepEqual(
- toArray(null),
- [],
- 'Should return an empty array for a null value'
- );
+ t.deepEqual(toArray(null), [], 'Should return an empty array for a null value');
- t.deepEqual(
- toArray('test'),
- ['test'],
- 'Should return an array with one element for a string'
- );
+ t.deepEqual(toArray('test'), ['test'], 'Should return an array with one element for a string');
t.end();
});
@@ -67,9 +59,17 @@ test('Utils -> getError', t => {
t.equal(getError('sorry'), 'sorry', 'should find error message from string');
t.equal(getError(), 'Something went wrong', 'should find error message from empty');
- t.equal(getError({error: {message: 'not good'}}), 'not good', 'should find error message from object');
- t.equal(getError({err: {error: 'not good'}}), 'not good', 'should find error message from object');
+ t.equal(
+ getError({error: {message: 'not good'}}),
+ 'not good',
+ 'should find error message from object'
+ );
+ t.equal(
+ getError({err: {error: 'not good'}}),
+ 'not good',
+ 'should find error message from object'
+ );
t.equal(getError({status: 400}), '{"status":400}', 'should find error message from object');
- t.end()
+ t.end();
});
diff --git a/test/setup-browser-env.js b/test/setup-browser-env.js
index b8bb12b83..59c7ce791 100644
--- a/test/setup-browser-env.js
+++ b/test/setup-browser-env.js
@@ -40,7 +40,7 @@ Object.defineProperty(window, 'fetch', {
new Promise((res, rej) => {
// we just let this never resolve
}),
- writable: true,
+ writable: true
});
const nop = () => {};