Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add vector module tests #2144

Benjamin King3dd3d8c3fa66
diff --git a/web/js/modules/vector-styles/action.test.js b/web/js/modules/vector-styles/action.test.js
new file mode 100644
index 000000000..de5272e06
--- /dev/null
+++ b/web/js/modules/vector-styles/action.test.js
@@ -0,0 +1,14 @@
+import { SET_SELECTED_VECTORS } from './constants';
+import { selectVectorFeatures } from './actions';
+
+test(
+ 'selectVectorFeature action returns ' + SET_SELECTED_VECTORS + ' action type',
+ () => {
+ const payload = 'test';
+ const expectedAction = {
+ type: SET_SELECTED_VECTORS,
+ payload
+ };
+ expect(selectVectorFeatures(payload)).toEqual(expectedAction);
+ }
+);
\ No newline at end of file
diff --git a/web/js/modules/vector-styles/actions.js b/web/js/modules/vector-styles/actions.js
index e95439a47..c8c69f727 100644
--- a/web/js/modules/vector-styles/actions.js
+++ b/web/js/modules/vector-styles/actions.js
@@ -47,7 +47,7 @@ export function setFilterRange(layerId, props, index, groupName) {
export function setStyle(layer, vectorStyleId, groupName) {
return (dispatch, getState) => {
const state = getState();
- const newActiveVectorStylesObj = setStyleFunction(
+ const newActiveVectorStylesObj = setStyleFunction( // should probably place this inside map.ui as it is a rendering
layer,
vectorStyleId,
state.vectorStyles.custom,
diff --git a/web/js/modules/vector-styles/reducer.test.js b/web/js/modules/vector-styles/reducer.test.js
new file mode 100644
index 000000000..988964d9b
--- /dev/null
+++ b/web/js/modules/vector-styles/reducer.test.js
@@ -0,0 +1,11 @@
+import { defaultVectorStyleState, vectorStyleReducer } from './reducers';
+import { SET_SELECTED_VECTORS } from './constants';
+
+test('Set a selected Vector', () => {
+ const response = vectorStyleReducer(defaultVectorStyleState, {
+ type: SET_SELECTED_VECTORS,
+ payload: { some_layer_id: ['some_feature_id'] }
+ });
+
+ expect(response.selected['some_layer_id'][0]).toEqual('some_feature_id');
+});
\ No newline at end of file