Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2577: Updating Unit Tests (#4174)

Ryan Weiler9179a6d20a11
diff --git a/doc/e2e_testing.md b/doc/e2e_testing.md
index f1a67c2e1..ef4d601b2 100644
--- a/doc/e2e_testing.md
+++ b/doc/e2e_testing.md
@@ -1,10 +1,10 @@
-# End To End Testing
+# End-To-End Testing
-End to end tests are integrated into our CI and are required to pass before a submission is accepted. New features should be accompanied by End to End tests to cover any new functionality you add.
+End-to-end tests are integrated into our CI and are required to pass before a submission is accepted. New features should be accompanied by end-to-end tests to cover any new functionality you add.
## Scripts
-- `e2e` : Builds WV and runs the end to end tests for Firefox & Chromium in a Docker container
+- `e2e` : Builds WV and runs the end-to-end tests for Firefox & Chromium in a Docker container
See the [Docker](docker.md) page for more information.
@@ -71,9 +71,9 @@ The basicHooks.js file contains hooks that perform generic operations such as th
The wvHooks.js file contains hooks that perform Worldview specific operations such as the `createDistanceMeasurement` hook that will create a line measurement based on a start and finish location.
-## Creating End To End Tests
+## Creating End-To-End Tests
-This section will go over the basics of creating an end to end test. This will use `recent-layers-test.spec.js` as an example if you want to follow along.
+This section will go over the basics of creating an end-to-end test. This will use `recent-layers-test.spec.js` as an example if you want to follow along.
### **Imports & Top Level Variables**
diff --git a/doc/testing.md b/doc/testing.md
index 359946c32..729afe6f6 100644
--- a/doc/testing.md
+++ b/doc/testing.md
@@ -11,24 +11,25 @@ Use `npm run lint:scss` or `npm run lint:js` to check SCSS or JS files separatel
## Unit Tests
Unit tests are run using the Jest testing framework. Unit tests ran as part of the main testing suite, i.e. `npm test`.
-Use `npm test:unit` to run unit tests individually.
-_Note:_ Make sure to run `npm run getcapabilities` and
-`npm run build:config` first to build the configuration.
+
+To run unit tests individually use the `npm run test:unit:tag` script and provide the unit tag. Ex: `npm run test:unit:tag -- alert-initial-state`. The tags can be found at the end of each test description in square brackets. `'Should return the initial state [alert-initial-state]'`.
+
+To run a batch of unit tests you can use the `npm run test:batch:directory` script and provide the module directory of the tests. This will run each file in the directory provided. Ex: `npm run test:batch:directory -- animation`. This will run the `actions.test.js`, `reducer.test.js` and `util.test.js` test files located in the `modules/animation` directory.
To test against a different time zone, run `npm run test:unit:tz`. _Note:_ This currently doesn't work in Windows.
To view the unit test code coverage, run `npm run test:coverage`.
Use `npm run test:unit:coverage` or `npm run test:unit:tz:coverage` to run coverage tests individually.
-## End-to-end Tests
+## End-To-End Tests
-End to end tests are integrated into our CI and are required to pass before a submission is accepted. New features should be accompanied by End to End tests to cover any new functionality you add.
+The end-to-end tests are integrated into our CI and are required to pass before a submission is accepted. New features should be accompanied by end-to-end tests to cover any new functionality you add.
Run end-to-end tests using `npm run e2e`
To run the end-to-end tests using Firefox in a docker container, create an image using `npm run docker:image`. Run the tests with `npm run docker:ci`. See the [Docker](docker.md) page for more information.
-See the [end to end testing](e2e_testing.md) page for more information on how to run the end to end tests.
+See the [end-to-end testing](e2e_testing.md) page for more information on how to run the end-to-end tests.
## Debug Parameters
diff --git a/package.json b/package.json
index 2ab93ad88..d0142acb5 100644
--- a/package.json
+++ b/package.json
@@ -57,6 +57,8 @@
"start": "node ./tasks/util/start.js",
"t-debug": "npx playwright test --debug",
"test": "run-script-os",
+ "test:unit:tag": "node ./tasks/util/runSingleUnitTest.js",
+ "test:batch:directory": "node ./tasks/util/runTestBatch.js",
"test:coverage": "run-script-os",
"test:coverage:default": "run-s test:unit:coverage test:unit:tz:coverage lint",
"test:coverage:win32": "run-s test:unit:coverage lint",
diff --git a/tasks/util/runSingleUnitTest.js b/tasks/util/runSingleUnitTest.js
new file mode 100644
index 000000000..9995c4100
--- /dev/null
+++ b/tasks/util/runSingleUnitTest.js
@@ -0,0 +1,34 @@
+const { execSync } = require('child_process')
+const { globSync } = require('glob')
+const fs = require('fs')
+
+const tag = process.argv[2]
+
+if (!tag) {
+ throw new Error('Please provide a tag to run the test.')
+}
+
+const testMatchPattern = '**/?(*.)test.js'
+
+const testFiles = globSync(testMatchPattern)
+
+const filesContainingTag = testFiles.filter((file) => {
+ const fileContent = fs.readFileSync(file, 'utf8')
+ const regex = new RegExp(`\\[${tag}\\]`, 'g')
+ return regex.test(fileContent)
+})
+
+if (filesContainingTag.length === 0) {
+ throw new Error(`No tests found with tag '${tag}'.`)
+}
+
+try {
+ const testPathPattern = filesContainingTag.map(file => `"${file.replace(/\\/g, '\\\\')}"`).join('|')
+ const testNamePattern = tag
+ const command = `jest --testPathPattern="${testPathPattern}" --testNamePattern="${testNamePattern}"`
+ execSync(command, { stdio: 'inherit' })
+} catch (error) {
+ throw new Error(error.status)
+}
+
+// npm run test:unit:tag -- alert-initial-state
diff --git a/tasks/util/runTestBatch.js b/tasks/util/runTestBatch.js
new file mode 100644
index 000000000..f07be5072
--- /dev/null
+++ b/tasks/util/runTestBatch.js
@@ -0,0 +1,18 @@
+const { execSync } = require('child_process')
+const path = require('path')
+
+const directory = process.argv[2]
+
+if (!directory) {
+ throw new Error('Please provide a directory to run the tests.')
+}
+
+try {
+ const testDirectory = path.join('web', 'js', 'modules', directory).replace(/\\/g, '/')
+ const command = `jest ${testDirectory}`
+ execSync(command, { stdio: 'inherit' })
+} catch (error) {
+ throw new Error(error.status)
+}
+
+// npm run test:batch:directory -- animation
diff --git a/web/js/modules/alerts/reducer.test.js b/web/js/modules/alerts/reducer.test.js
index 84d5a3d05..eebd906dc 100644
--- a/web/js/modules/alerts/reducer.test.js
+++ b/web/js/modules/alerts/reducer.test.js
@@ -7,12 +7,12 @@ import {
} from './constants';
describe('alertReducer', () => {
- test('should return the initial state', () => {
+ test('Should return the initial state [alert-initial-state]', () => {
expect(alertReducer(undefined, {})).toEqual(
defaultAlertState,
);
});
- test('DISABLE_VECTOR_ZOOM_ALERT should disable vector zoom alert state', () => {
+ test('DISABLE_VECTOR_ZOOM_ALERT should disable vector zoom alert state [alert-disable-vector-zoom]', () => {
expect(alertReducer(
{ ...defaultAlertState, isVectorZoomAlertPresent: true },
{ type: DISABLE_VECTOR_ZOOM_ALERT },
@@ -20,14 +20,14 @@ describe('alertReducer', () => {
defaultAlertState,
);
});
- test('ACTIVATE_VECTOR_ZOOM_ALERT should enable vector zoom alert state', () => {
+ test('ACTIVATE_VECTOR_ZOOM_ALERT should enable vector zoom alert state [alert-activate-vector-zoom]', () => {
const vectorZoomEnabledState = { ...defaultAlertState, isVectorZoomAlertPresent: true };
expect(alertReducer(
undefined,
{ type: ACTIVATE_VECTOR_ZOOM_ALERT },
)).toEqual(vectorZoomEnabledState);
});
- test('DISABLE_VECTOR_EXCEEDED_ALERT should disable vector exceeded results alert state', () => {
+ test('DISABLE_VECTOR_EXCEEDED_ALERT should disable vector exceeded results alert state [alert-disable-vector-exceed]', () => {
expect(alertReducer(
{ ...defaultAlertState, isVectorExceededAlertPresent: true },
{ type: DISABLE_VECTOR_EXCEEDED_ALERT },
@@ -35,7 +35,7 @@ describe('alertReducer', () => {
defaultAlertState,
);
});
- test('ACTIVATE_VECTOR_EXCEEDED_ALERT should enable vector exceeded results alert state', () => {
+ test('ACTIVATE_VECTOR_EXCEEDED_ALERT should enable vector exceeded results alert state [alert-activate-vector-exceed]', () => {
const vectorExceededEnabledState = { ...defaultAlertState, isVectorExceededAlertPresent: true };
expect(alertReducer(
undefined,
diff --git a/web/js/modules/animation/actions.test.js b/web/js/modules/animation/actions.test.js
index 6f915eb59..b326af198 100644
--- a/web/js/modules/animation/actions.test.js
+++ b/web/js/modules/animation/actions.test.js
@@ -22,7 +22,7 @@ const state = fixtures.getState();
describe('Open, play, stop, close and toggle actions', () => {
test(
- `onClose action returns ${constants.EXIT_ANIMATION} action type`,
+ `onClose action returns ${constants.EXIT_ANIMATION} action type [animation-action-exit]`,
() => {
const expectedAction = {
type: constants.EXIT_ANIMATION,
@@ -31,7 +31,7 @@ describe('Open, play, stop, close and toggle actions', () => {
},
);
test(
- `play action returns ${constants.PLAY_ANIMATION} action type`,
+ `play action returns ${constants.PLAY_ANIMATION} action type [animation-action-play]`,
() => {
const expectedAction = {
type: constants.PLAY_ANIMATION,
@@ -40,7 +40,7 @@ describe('Open, play, stop, close and toggle actions', () => {
},
);
test(
- `stop action returns ${constants.STOP_ANIMATION} action type`,
+ `stop action returns ${constants.STOP_ANIMATION} action type [animation-action-stop]`,
() => {
const expectedAction = {
type: constants.STOP_ANIMATION,
@@ -49,7 +49,7 @@ describe('Open, play, stop, close and toggle actions', () => {
},
);
test(
- `toggleLooping action returns ${constants.TOGGLE_LOOPING} action type`,
+ `toggleLooping action returns ${constants.TOGGLE_LOOPING} action type [animation-action-loop]`,
() => {
const expectedAction = {
type: constants.TOGGLE_LOOPING,
@@ -60,7 +60,7 @@ describe('Open, play, stop, close and toggle actions', () => {
test(
`toggleComponentGifActive action returns ${
constants.TOGGLE_GIF
- } action type`,
+ } action type [animation-action-gif]`,
() => {
const expectedAction = {
type: constants.TOGGLE_GIF,
@@ -75,7 +75,7 @@ describe('Animation Datechange actions', () => {
test(
`changeStartDate action returns ${
constants.UPDATE_START_DATE
- } action type and current date as value`,
+ } action type and current date as value [animation-action-start-date]`,
() => {
const expectedAction = {
type: constants.UPDATE_START_DATE,
@@ -89,7 +89,7 @@ describe('Animation Datechange actions', () => {
test(
`changeEndDate action returns ${
constants.UPDATE_END_DATE
- } action type and current date as value`,
+ } action type and current date as value [animation-action-end-date]`,
() => {
const response = changeEndDate(now);
expect(response.type).toEqual(constants.UPDATE_END_DATE);
@@ -99,7 +99,7 @@ describe('Animation Datechange actions', () => {
test(
`changeStartAndEndDate action returns ${
constants.UPDATE_START_AND_END_DATE
- } action type and current date as value`,
+ } action type and current date as value [animation-action-start-and-end-date]`,
() => {
const response = changeStartAndEndDate(then, now);
expect(response.type).toEqual(constants.UPDATE_START_AND_END_DATE);
@@ -112,7 +112,7 @@ describe('Animation Datechange actions', () => {
test(
`changeFrameRate action returns ${
constants.UPDATE_FRAME_RATE
- } action type and number value`,
+ } action type and number value [animation-action-speed]`,
() => {
const response = changeFrameRate(2);
expect(response.type).toEqual(constants.UPDATE_FRAME_RATE);
@@ -122,7 +122,7 @@ test(
test(
`onActivate action returns ${
constants.OPEN_ANIMATION
- } action type and current dateValue`,
+ } action type and current dateValue [animation-action-activate]`,
() => {
const mockStore = configureMockStore(middlewares);
const store = mockStore(state);
@@ -139,7 +139,7 @@ test(
);
test(
- `changeBoundary action returns ${constants.UPDATE_CROP_BOUNDS} action type and current bounds value`,
+ `changeBoundary action returns ${constants.UPDATE_CROP_BOUNDS} action type and current bounds value [animation-action-boundary]`,
() => {
const mockStore = configureMockStore(middlewares);
const store = mockStore(state);
diff --git a/web/js/modules/animation/reducer.test.js b/web/js/modules/animation/reducer.test.js
index 37b118ac3..7cbe7e263 100644
--- a/web/js/modules/animation/reducer.test.js
+++ b/web/js/modules/animation/reducer.test.js
@@ -6,7 +6,7 @@ import util from '../../util/util';
const now = util.now();
const then = util.dateAdd(now, 'day', -7);
-test('OPEN_ANIMATION action updates active state', () => {
+test('OPEN_ANIMATION action updates active state [animation-reducer-open]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.OPEN_ANIMATION,
});
@@ -14,7 +14,7 @@ test('OPEN_ANIMATION action updates active state', () => {
expect(response.isActive).toEqual(true);
});
-test('EXIT_ANIMATION action toggles isPlaying and isActive values', () => {
+test('EXIT_ANIMATION action toggles isPlaying and isActive values [animation-reducer-exit]', () => {
let updatedState = update(defaultState, { isActive: { $set: true } });
updatedState = update(updatedState, { isPlaying: { $set: true } });
const response = animationReducer(updatedState, {
@@ -25,14 +25,14 @@ test('EXIT_ANIMATION action toggles isPlaying and isActive values', () => {
expect(response.isActive).toEqual(false);
expect(response.isPlaying).toEqual(false);
});
-test('PLAY_ANIMATION action makes isPlaying truthy', () => {
+test('PLAY_ANIMATION action makes isPlaying truthy [animation-reducer-play]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.PLAY_ANIMATION,
});
expect(defaultState.isPlaying).toEqual(false);
expect(response.isPlaying).toEqual(true);
});
-test('UPDATE_FRAME_RATE action changes speed value', () => {
+test('UPDATE_FRAME_RATE action changes speed value [animation-reducer-speed]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.UPDATE_FRAME_RATE,
value: 5,
@@ -40,7 +40,7 @@ test('UPDATE_FRAME_RATE action changes speed value', () => {
expect(defaultState.speed).toEqual(3);
expect(response.speed).toEqual(5);
});
-test('UPDATE_START_AND_END_DATE action updates dates', () => {
+test('UPDATE_START_AND_END_DATE action updates dates [animation-reducer-start-and-end-date]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.UPDATE_START_AND_END_DATE,
startDate: then,
@@ -51,7 +51,7 @@ test('UPDATE_START_AND_END_DATE action updates dates', () => {
expect(response.startDate).toEqual(then);
expect(response.endDate).toEqual(now);
});
-test('UPDATE_START_DATE action changes startDate value', () => {
+test('UPDATE_START_DATE action changes startDate value [animation-reducer-start-date]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.UPDATE_START_DATE,
value: then,
@@ -59,7 +59,7 @@ test('UPDATE_START_DATE action changes startDate value', () => {
expect(defaultState.startDate).toBeUndefined();
expect(response.startDate).toEqual(then);
});
-test('UPDATE_END_DATE action changes endDate value', () => {
+test('UPDATE_END_DATE action changes endDate value [animation-reducer-end-date]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.UPDATE_END_DATE,
value: now,
@@ -67,14 +67,14 @@ test('UPDATE_END_DATE action changes endDate value', () => {
expect(defaultState.startDate).toBeUndefined();
expect(response.endDate).toEqual(now);
});
-test('TOGGLE_LOOPING action toggles loop value', () => {
+test('TOGGLE_LOOPING action toggles loop value [animation-reducer-loop]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.TOGGLE_LOOPING,
});
expect(defaultState.loop).toBeFalsy();
expect(response.loop).toBeTruthy();
});
-test('TOGGLE_GIF action toggles gifActive bool value', () => {
+test('TOGGLE_GIF action toggles gifActive bool value [animation-reducer-gif]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.TOGGLE_GIF,
});
@@ -82,7 +82,7 @@ test('TOGGLE_GIF action toggles gifActive bool value', () => {
expect(response.gifActive).toBeTruthy();
});
-test('KEY_PRESS_ACTION action toggles isPlaying bool when animation is active', () => {
+test('KEY_PRESS_ACTION action toggles isPlaying bool when animation is active [animation-reducer-key-press-active]', () => {
const updatedState = update(defaultState, { isActive: { $set: true } });
const response = animationReducer(updatedState, {
type: CONSTANTS.KEY_PRESS_ACTION,
@@ -91,7 +91,7 @@ test('KEY_PRESS_ACTION action toggles isPlaying bool when animation is active',
expect(updatedState.isPlaying).toBeFalsy();
expect(response.isPlaying).toBeTruthy();
});
-test('KEY_PRESS_ACTION action does not toggle isPlaying bool when animation is inActive', () => {
+test('KEY_PRESS_ACTION action does not toggle isPlaying bool when animation is inActive [animation-reducer-key-press-disabled]', () => {
const response = animationReducer(defaultState, {
type: CONSTANTS.KEY_PRESS_ACTION,
keyCode: 32,
diff --git a/web/js/modules/animation/util.test.js b/web/js/modules/animation/util.test.js
index 69686198b..42280d739 100644
--- a/web/js/modules/animation/util.test.js
+++ b/web/js/modules/animation/util.test.js
@@ -4,7 +4,7 @@ import {
} from './util';
import { defaultState } from './reducers';
-test('mapLocationToAnimationState updates state to have isPlaying bool true if playanim and ab keys are present', () => {
+test('mapLocationToAnimationState updates state to have isPlaying bool true if playanim and ab keys are present [animation-location-state]', () => {
const stateFromLocation = { animation: defaultState };
const PERMALINK_STATE = { ab: true, playanim: true };
const response = mapLocationToAnimationState(
@@ -15,7 +15,7 @@ test('mapLocationToAnimationState updates state to have isPlaying bool true if p
expect(response.animation.isPlaying).toBeTruthy();
});
-test('snapToIntervalDelta snaps at the year interval', () => {
+test('snapToIntervalDelta snaps at the year interval [animation-year-interval]', () => {
const currentDate = new Date('2010-06-23');
const startDate = new Date(' 2000-04-15');
const endDate = new Date(' 2019-08-24');
@@ -24,7 +24,7 @@ test('snapToIntervalDelta snaps at the year interval', () => {
expect(snappedDate.valueOf()).toBe(expected.valueOf());
});
-test('snapToIntervalDelta snaps at the month interval', () => {
+test('snapToIntervalDelta snaps at the month interval [animation-month-interval]', () => {
const currentDate = new Date('2018-6-23');
const startDate = new Date(' 2018-4-15');
const endDate = new Date(' 2019-8-24');
@@ -33,7 +33,7 @@ test('snapToIntervalDelta snaps at the month interval', () => {
expect(snappedDate.valueOf()).toBe(expected.valueOf());
});
-test('snapToIntervalDelta snaps at the day interval', () => {
+test('snapToIntervalDelta snaps at the day interval [animation-day-interval]', () => {
const currentDate = new Date('2018-07-04 12:34:00Z');
const startDate = new Date(' 2018-04-15 08:00:00Z');
const endDate = new Date(' 2018-08-24');
@@ -42,7 +42,7 @@ test('snapToIntervalDelta snaps at the day interval', () => {
expect(snappedDate.valueOf()).toBe(expected.valueOf());
});
-test('snapToIntervalDelta snaps at the hour interval', () => {
+test('snapToIntervalDelta snaps at the hour interval [animation-hour-interval]', () => {
const currentDate = new Date('2018-07-04 12:34:00Z');
const startDate = new Date(' 2018-04-15 08:00:00Z');
const endDate = new Date(' 2018-08-24');
@@ -51,7 +51,7 @@ test('snapToIntervalDelta snaps at the hour interval', () => {
expect(snappedDate.valueOf()).toBe(expected.valueOf());
});
-test('snapToIntervalDelta snaps at the minute interval', () => {
+test('snapToIntervalDelta snaps at the minute interval [animation-minute-interval]', () => {
const currentDate = new Date('2018-04-19 08:24:56Z');
const startDate = new Date(' 2018-04-19 08:15:30Z');
const endDate = new Date(' 2018-04-19 08:30:30Z');
@@ -60,7 +60,7 @@ test('snapToIntervalDelta snaps at the minute interval', () => {
expect(snappedDate.valueOf()).toBe(expected.valueOf());
});
-test('snapToIntervalDelta snaps at a custom hour interval', () => {
+test('snapToIntervalDelta snaps at a custom hour interval [animation-custom-hour-interval]', () => {
const currentDate = new Date('2018-04-02 06:15:23Z');
const startDate = new Date(' 2018-04-01 00:00:00Z');
const endDate = new Date(' 2018-04-19 00:00:00Z');
@@ -69,7 +69,7 @@ test('snapToIntervalDelta snaps at a custom hour interval', () => {
expect(snappedDate.valueOf()).toBe(expected.valueOf());
});
-test('snapToIntervalDelta snaps at custom 10 minute interval', () => {
+test('snapToIntervalDelta snaps at custom 10 minute interval [animation-custom-minute-interval]', () => {
const currentDate = new Date('2018-04-19 08:24:00Z');
const startDate = new Date(' 2018-04-19 08:00:00Z');
const endDate = new Date(' 2018-04-19 09:00:00Z');
@@ -78,7 +78,7 @@ test('snapToIntervalDelta snaps at custom 10 minute interval', () => {
expect(snappedDate.valueOf()).toBe(expected.valueOf());
});
-test('snapToIntervalDelta snaps to startDate if currentDate is after endDate', () => {
+test('snapToIntervalDelta snaps to startDate if currentDate is after endDate [animation-current-greater-than-end]', () => {
const currentDate = new Date('2019-05-15 08:00:00Z');
const startDate = new Date(' 2018-04-19 08:15:30Z');
const endDate = new Date(' 2018-04-19 08:30:30Z');
@@ -87,7 +87,7 @@ test('snapToIntervalDelta snaps to startDate if currentDate is after endDate', (
expect(snappedDate.valueOf()).toBe(expected.valueOf());
});
-test('snapToIntervalDelta snaps to startDate if currentDate is before startDate', () => {
+test('snapToIntervalDelta snaps to startDate if currentDate is before startDate [animation-current-less-than-start]', () => {
const currentDate = new Date('2018-03-22 08:00:00');
const startDate = new Date(' 2018-04-19 08:15:30Z');
const endDate = new Date(' 2018-04-19 08:30:30Z');
diff --git a/web/js/modules/compare/actions.test.js b/web/js/modules/compare/actions.test.js
index 248ab1723..dbc78e93c 100644
--- a/web/js/modules/compare/actions.test.js
+++ b/web/js/modules/compare/actions.test.js
@@ -14,7 +14,7 @@ import { INIT_SECOND_DATE, CLEAR_PRELOAD } from '../date/constants';
const middlewares = [thunk];
const state = fixtures.getState();
-test('toggleCompareOnOff dispatches two actions', () => {
+test('toggleCompareOnOff dispatches two actions [compare-action-toggle-return-actions]', () => {
const mockStore = configureMockStore(middlewares);
const store = mockStore(state);
store.dispatch(toggleCompareOnOff());
@@ -28,7 +28,7 @@ test('toggleCompareOnOff dispatches two actions', () => {
});
test(
- `toggleActiveCompareState returns ${CONSTANTS.CHANGE_STATE} action type`,
+ `toggleActiveCompareState returns ${CONSTANTS.CHANGE_STATE} action type [compare-action-toggle]`,
() => {
const mockStore = configureMockStore(middlewares);
const store = mockStore(state);
@@ -42,7 +42,7 @@ test(
},
);
test(
- `setValue returns ${CONSTANTS.CHANGE_VALUE} action type and value`,
+ `setValue returns ${CONSTANTS.CHANGE_VALUE} action type and value [compare-action-set-value]`,
() => {
const expectedAction = {
type: CONSTANTS.CHANGE_VALUE,
@@ -53,7 +53,7 @@ test(
);
test(
- `changeMode returns ${CONSTANTS.CHANGE_MODE} action type and mode value`,
+ `changeMode returns ${CONSTANTS.CHANGE_MODE} action type and mode value [compare-action-change-mode]`,
() => {
const expectedAction = {
type: CONSTANTS.CHANGE_MODE,
diff --git a/web/js/modules/compare/reducers.test.js b/web/js/modules/compare/reducers.test.js
index b7eec794e..1c1ac7487 100644
--- a/web/js/modules/compare/reducers.test.js
+++ b/web/js/modules/compare/reducers.test.js
@@ -1,7 +1,7 @@
import { initialCompareState, compareReducer } from './reducers';
import * as CONSTANTS from './constants';
-test('CHANGE_STATE update active state and activeString', () => {
+test('CHANGE_STATE update active state and activeString [compare-reducer-change-state]', () => {
const response = compareReducer(initialCompareState, {
type: CONSTANTS.CHANGE_STATE,
});
@@ -11,7 +11,7 @@ test('CHANGE_STATE update active state and activeString', () => {
expect(response.isCompareA).toBeFalsy();
});
-test('TOGGLE_ON_OFF toggles compare feature on and off', () => {
+test('TOGGLE_ON_OFF toggles compare feature on and off [compare-reducer-toggle]', () => {
const response = compareReducer(initialCompareState, {
type: CONSTANTS.TOGGLE_ON_OFF,
});
@@ -19,7 +19,7 @@ test('TOGGLE_ON_OFF toggles compare feature on and off', () => {
expect(response.active).toBeTruthy();
});
-test('CHANGE_MODE updates mode', () => {
+test('CHANGE_MODE updates mode [compare-reducer-change-mode]', () => {
const response = compareReducer(initialCompareState, {
type: CONSTANTS.CHANGE_MODE,
mode: 'new-mode',
diff --git a/web/js/modules/compare/util.test.js b/web/js/modules/compare/util.test.js
index 0b0e659ce..f2d53e0c5 100644
--- a/web/js/modules/compare/util.test.js
+++ b/web/js/modules/compare/util.test.js
@@ -4,7 +4,7 @@ import { initialCompareState } from './reducers';
const stateFromLocation = { compare: initialCompareState };
const PERMALINK_STATE = { ca: '' };
-test('mapLocationToCompareState sets compare as active is ca is defined permalink', () => {
+test('mapLocationToCompareState sets compare as active is ca is defined permalink [compare-permalink]', () => {
const response = mapLocationToCompareState(
PERMALINK_STATE,
stateFromLocation,
diff --git a/web/js/modules/date/actions.test.js b/web/js/modules/date/actions.test.js
index 0e89fbba5..385390d87 100644
--- a/web/js/modules/date/actions.test.js
+++ b/web/js/modules/date/actions.test.js
@@ -58,7 +58,7 @@ const interval = 3;
describe('Date timescale changes', () => {
test(
- `changeTimeScale action returns ${CHANGE_TIME_SCALE} as type and ${interval} as value`,
+ `changeTimeScale action returns ${CHANGE_TIME_SCALE} as type and ${interval} as value [date-action-time-scale]`,
() => {
const expectedAction = {
type: CHANGE_TIME_SCALE,
@@ -69,7 +69,7 @@ describe('Date timescale changes', () => {
);
test(
- `updateAppNow action returns ${UPDATE_APP_NOW} as type and ${mockDate} as value`,
+ `updateAppNow action returns ${UPDATE_APP_NOW} as type and ${mockDate} as value [date-action-update-app-now]`,
() => {
const expectedAction = {
type: UPDATE_APP_NOW,
@@ -80,7 +80,7 @@ describe('Date timescale changes', () => {
);
test(
- `selectDate action returns ${SELECT_DATE} as type, 'selected' as activeString, and ${mockDate} as value`,
+ `selectDate action returns ${SELECT_DATE} as type, 'selected' as activeString, and ${mockDate} as value [date-action-select-date]`,
() => {
const expectedFirst = {
type: CLEAR_PRELOAD,
@@ -122,7 +122,7 @@ describe('Date timescale changes', () => {
);
test(
- `selectDate action returns ${SELECT_DATE} as type and selectedB as activeString and ${mockDate} as value`,
+ `selectDate action returns ${SELECT_DATE} as type and selectedB as activeString and ${mockDate} as value [date-action-select-date-b]`,
() => {
const prevDate = new Date('2021-01-01');
const expectedFirst = {
@@ -165,7 +165,7 @@ describe('Date timescale changes', () => {
);
test(
- `changeCustomInterval action returns ${CHANGE_CUSTOM_INTERVAL} as type and ${customInterval} as value and ${delta} as delta`,
+ `changeCustomInterval action returns ${CHANGE_CUSTOM_INTERVAL} as type and ${customInterval} as value and ${delta} as delta [date-action-custom-interval]`,
() => {
const store = mockStore({
date: {},
@@ -192,7 +192,7 @@ describe('Date timescale changes', () => {
);
test(
- `selectInterval action returns ${CHANGE_INTERVAL} as type and ${interval} as value and ${delta} as delta and true as customSelected`,
+ `selectInterval action returns ${CHANGE_INTERVAL} as type and ${interval} as value and ${delta} as delta and true as customSelected [date-action-interval]`,
() => {
const store = mockStore({
date: {},
diff --git a/web/js/modules/date/reducers.test.js b/web/js/modules/date/reducers.test.js
index af40f5221..91c652e20 100644
--- a/web/js/modules/date/reducers.test.js
+++ b/web/js/modules/date/reducers.test.js
@@ -16,7 +16,7 @@ const mockDate = util.now();
const selectedZoom = 2;
describe('dateReducer', () => {
- test('should return the initial state', () => {
+ test('should return the initial state [date-reducer-initial-state]', () => {
expect(dateReducer(undefined, {})).toEqual(
dateReducerState,
);
@@ -24,7 +24,7 @@ describe('dateReducer', () => {
test(
`${CHANGE_TIME_SCALE
}action type and ${selectedZoom} as selectedZoom `
- + 'should return new state',
+ + 'should return new state [date-reducer-time-scale]',
() => {
expect(
dateReducer(dateReducerState, {
@@ -40,7 +40,7 @@ describe('dateReducer', () => {
test(
`${CHANGE_CUSTOM_INTERVAL
}action type and 4 as customInterval and 10 as customDelta `
- + 'should return new state',
+ + 'should return new state [date-reducer-custom-interval]',
() => {
expect(
dateReducer(dateReducerState, {
@@ -59,7 +59,7 @@ describe('dateReducer', () => {
test(
`${CHANGE_INTERVAL
}action type and 1 as delta and 2 as interval `
- + 'should return new state',
+ + 'should return new state [date-reducer-interval]',
() => {
expect(
dateReducer(dateReducerState, {
@@ -78,7 +78,7 @@ describe('dateReducer', () => {
);
test(
`${SELECT_DATE} action type and ${mockDate} as value and selected `
- + 'as activeString should return new state',
+ + 'as activeString should return new state [date-reducer-selected]',
() => {
expect(
dateReducer(dateReducerState, {
@@ -95,7 +95,7 @@ describe('dateReducer', () => {
test(
`${SELECT_DATE
}action type and ${mockDate} as value and selectedB `
- + 'as activeString should return new state',
+ + 'as activeString should return new state [date-reducer-selectedB]',
() => {
expect(
dateReducer(dateReducerState, {
@@ -111,7 +111,7 @@ describe('dateReducer', () => {
);
test(
`${UPDATE_APP_NOW
- }action type and ${mockDate} as value should return new state`,
+ }action type and ${mockDate} as value should return new state [date-reducer-update-app-now]`,
() => {
expect(
dateReducer(dateReducerState, {
diff --git a/web/js/modules/date/util.test.js b/web/js/modules/date/util.test.js
index a67783eeb..a3315f9ae 100644
--- a/web/js/modules/date/util.test.js
+++ b/web/js/modules/date/util.test.js
@@ -5,7 +5,7 @@ import fixtures from '../../fixtures';
const state = fixtures.getState();
-test('parses date 1.1', () => {
+test('parses date 1.1 [date-parse-1.1]', () => {
const d = new Date(Date.UTC(2013, 0, 5));
const param = {
time: '2013-01-05',
@@ -17,7 +17,7 @@ test('parses date 1.1', () => {
stateFromLocation = mapLocationToDateState(param, stateFromLocation, state);
expect(stateFromLocation.date.selected).toMatchObject(d);
});
-test('parses valid date: 1.2', () => {
+test('parses valid date: 1.2 [date-parse-1.2]', () => {
const d = new Date(Date.UTC(2013, 0, 5));
const param = {
t: '2013-01-05',
@@ -25,7 +25,7 @@ test('parses valid date: 1.2', () => {
const date = tryCatchDate(param.t, state.date.appNow);
expect(date).toEqual(d);
});
-test('If date is invalid, uses Initial Time', () => {
+test('If date is invalid, uses Initial Time [date-invalid]', () => {
const param = {
time: 'X',
};
@@ -39,129 +39,129 @@ test('If date is invalid, uses Initial Time', () => {
describe('rollDate', () => {
const tests = [{
- name: 'day up',
+ name: 'day up [date-day-up]',
d: new Date(Date.UTC(2014, 1, 15)),
period: { value: 1, unit: 'day' },
answer: new Date(Date.UTC(2014, 1, 16)),
}, {
- name: 'day up, roll',
+ name: 'day up, roll [date-day-up-roll]',
d: new Date(Date.UTC(2014, 1, 28)),
period: { value: 1, unit: 'day' },
answer: new Date(Date.UTC(2014, 1, 1)),
}, {
- name: 'day down',
+ name: 'day down [date-day-down]',
d: new Date(Date.UTC(2014, 1, 15)),
period: { value: -1, unit: 'day' },
answer: new Date(Date.UTC(2014, 1, 14)),
}, {
- name: 'day down, roll',
+ name: 'day down, roll [date-day-down-roll]',
d: new Date(Date.UTC(2014, 1, 1)),
period: { value: -1, unit: 'day' },
answer: new Date(Date.UTC(2014, 1, 28)),
}, {
- name: 'day up, roll over max',
+ name: 'day up, roll over max [date-day-up-roll-max]',
maxDate: new Date(Date.UTC(2014, 11, 2)),
d: new Date(Date.UTC(2014, 11, 2)),
period: { value: 1, unit: 'day' },
answer: new Date(Date.UTC(2014, 11, 1)),
}, {
- name: 'day down, roll over max',
+ name: 'day down, roll over max [date-day-down-roll-max]',
maxDate: new Date(Date.UTC(2014, 11, 2)),
d: new Date(Date.UTC(2014, 11, 1)),
period: { value: -1, unit: 'day' },
answer: new Date(Date.UTC(2014, 11, 2)),
}, {
- name: 'day up, roll over min',
+ name: 'day up, roll over min [date-day-up-roll-min]',
minDate: new Date(Date.UTC(2014, 11, 2)),
d: new Date(Date.UTC(2014, 11, 31)),
period: { value: 1, unit: 'day' },
answer: new Date(Date.UTC(2014, 11, 2)),
}, {
- name: 'day down, roll over min',
+ name: 'day down, roll over min [date-day-down-roll-min]',
minDate: new Date(Date.UTC(2014, 11, 2)),
d: new Date(Date.UTC(2014, 11, 2)),
period: { value: -1, unit: 'day' },
answer: new Date(Date.UTC(2014, 11, 31)),
}, {
- name: 'month up',
+ name: 'month up [date-month-up]',
d: new Date(Date.UTC(2014, 5, 15)),
period: { value: 1, unit: 'month' },
answer: new Date(Date.UTC(2014, 6, 15)),
}, {
- name: 'month up, roll',
+ name: 'month up, roll [date-month-up-roll]',
d: new Date(Date.UTC(2014, 11, 15)),
period: { value: 1, unit: 'month' },
answer: new Date(Date.UTC(2014, 0, 15)),
}, {
- name: 'month down',
+ name: 'month down [date-month-down]',
d: new Date(Date.UTC(2014, 5, 15)),
period: { value: -1, unit: 'month' },
answer: new Date(Date.UTC(2014, 4, 15)),
}, {
- name: 'month down, roll',
+ name: 'month down, roll [date-month-down-roll]',
d: new Date(Date.UTC(2014, 0, 15)),
period: { value: -1, unit: 'month' },
answer: new Date(Date.UTC(2014, 11, 15)),
}, {
- name: 'month up, roll over max',
+ name: 'month up, roll over max [date-month-up-roll-max]',
maxDate: new Date(Date.UTC(2014, 10, 2)),
d: new Date(Date.UTC(2014, 9, 20)),
period: { value: 1, unit: 'month' },
answer: new Date(Date.UTC(2014, 10, 2)),
}, {
- name: 'month up, roll past max',
+ name: 'month up, roll past max [date-month-up-roll-past-max]',
maxDate: new Date(Date.UTC(2014, 10, 2)),
d: new Date(Date.UTC(2014, 10, 1)),
period: { value: 1, unit: 'month' },
answer: new Date(Date.UTC(2014, 0, 1)),
}, {
- name: 'month down, roll over max',
+ name: 'month down, roll over max [date-month-down-roll-max]',
maxDate: new Date(Date.UTC(2014, 10, 2)),
d: new Date(Date.UTC(2014, 0, 20)),
period: { value: -1, unit: 'month' },
answer: new Date(Date.UTC(2014, 10, 2)),
}, {
- name: 'month up, truncate day',
+ name: 'month up, truncate day [date-month-up-truncate-day]',
d: new Date(Date.UTC(2014, 0, 31)),
period: { value: 1, unit: 'month' },
answer: new Date(Date.UTC(2014, 1, 28)),
}, {
- name: 'month down, roll over min',
+ name: 'month down, roll over min [date-month-down-roll-min]',
minDate: new Date(Date.UTC(2014, 2, 25)),
d: new Date(Date.UTC(2014, 3, 1)),
period: { value: -1, unit: 'month' },
answer: new Date(Date.UTC(2014, 2, 25)),
}, {
- name: 'month up, roll over min',
+ name: 'month up, roll over min [date-month-up-roll-min]',
minDate: new Date(Date.UTC(2014, 2, 25)),
d: new Date(Date.UTC(2014, 11, 1)),
period: { value: 1, unit: 'month' },
answer: new Date(Date.UTC(2014, 2, 25)),
}, {
- name: 'month down, roll past min',
+ name: 'month down, roll past min [date-month-down-roll-past-min]',
minDate: new Date(Date.UTC(2014, 2, 25)),
d: new Date(Date.UTC(2014, 2, 27)),
period: { value: -1, unit: 'month' },
answer: new Date(Date.UTC(2014, 11, 27)),
}, {
- name: 'year up',
+ name: 'year up [date-year-up]',
d: new Date(Date.UTC(2014, 5, 15)),
period: { value: 1, unit: 'year' },
answer: new Date(Date.UTC(2015, 5, 15)),
}, {
- name: 'year down',
+ name: 'year down [date-year-down]',
d: new Date(Date.UTC(2014, 5, 15)),
period: { value: -1, unit: 'year' },
answer: new Date(Date.UTC(2013, 5, 15)),
}, {
- name: 'year up, roll over max',
+ name: 'year up, roll over max [date-year-up-roll-max]',
minDate: new Date(Date.UTC(2000, 3, 12)),
maxDate: new Date(Date.UTC(2015, 6, 16)),
d: new Date(Date.UTC(2015, 0, 1)),
period: { value: 1, unit: 'year' },
answer: new Date(Date.UTC(2000, 3, 12)),
}, {
- name: 'year down, roll over min',
+ name: 'year down, roll over min [date-year-down-roll-min]',
minDate: new Date(Date.UTC(2000, 3, 12)),
maxDate: new Date(Date.UTC(2015, 6, 16)),
d: new Date(Date.UTC(2000, 8, 1)),
@@ -198,12 +198,12 @@ describe('roll', () => {
});
describe('daysInMonth', () => {
- test('feb, non-leap', () => {
+ test('feb, non-leap [date-non-leap]', () => {
const d = new Date(Date.UTC(2015, 1, 15));
expect(getDaysInMonth(d)).toBe(28);
});
- test('feb, leap', () => {
+ test('feb, leap [date-leap]', () => {
const d = new Date(Date.UTC(2016, 1, 15));
expect(getDaysInMonth(d)).toBe(29);
});
diff --git a/web/js/modules/image-download/util.test.js b/web/js/modules/image-download/util.test.js
index 200ff7bf4..f791c7a49 100644
--- a/web/js/modules/image-download/util.test.js
+++ b/web/js/modules/image-download/util.test.js
@@ -171,7 +171,7 @@ const mockLayerDefsSubdaily = [
},
];
-test('bboxWMS13', () => {
+test('bboxWMS13 [imagedownload-bbox]', () => {
const coords = [[11, 22], [33, 44]];
const bboxGeo = bboxWMS13(coords, 'EPSG:4326');
expect(bboxGeo).toBe('22,11,44,33');
@@ -179,27 +179,27 @@ test('bboxWMS13', () => {
expect(bboxArctic).toBe('11,22,33,44');
});
-test('Default km resolution Calculation', () => {
+test('Default km resolution Calculation [imagedownload-default-resolution]', () => {
const zoom = 5;
const isGeo = true;
expect(imageUtilCalculateResolution(zoom, isGeo, geoResolutions)).toBe('4');
});
-test('Date time snapping when no subdaily layers present', () => {
+test('Date time snapping when no subdaily layers present [imagedownload-time-snap-no-subdaily]', () => {
const mockDate = new Date('2019-09-15T18:32:40Z');
const expectedTime = new Date('2019-09-15T00:00:00Z');
const snappedDateTime = getLatestIntervalTime(mockLayerDefs, mockDate);
expect(snappedDateTime.getTime()).toBe(expectedTime.getTime());
});
-test('Date time snapping with subdaily layers present', () => {
+test('Date time snapping with subdaily layers present [imagedownload-time-snap-subdaily]', () => {
const mockDate = new Date('2019-09-15T18:32:40Z');
const expectedTime = new Date('2019-09-15T18:30:00Z');
const snappedDateTime = getLatestIntervalTime(mockLayerDefsSubdaily, mockDate);
expect(snappedDateTime.getTime()).toBe(expectedTime.getTime());
});
-test('Download URL', () => {
+test('Download URL [imagedownload-url]', () => {
const url = 'http://localhost:3002/api/v1/snapshot';
const proj = {
id: 'geographic',
diff --git a/web/js/modules/layers/actions.test.js b/web/js/modules/layers/actions.test.js
index 65cb57d11..4747b0063 100644
--- a/web/js/modules/layers/actions.test.js
+++ b/web/js/modules/layers/actions.test.js
@@ -63,7 +63,7 @@ describe('Layer actions', () => {
store = mockStore(getState(layers));
});
- test('REMOVE_LAYER action removes layer by id', () => {
+ test('REMOVE_LAYER action removes layer by id [layers-action-remove-layer-by-id]', () => {
const def = layers[0];
store.dispatch(removeLayer('aqua-aod'));
const actionResponse = store.getActions()[0];
@@ -79,14 +79,14 @@ describe('Layer actions', () => {
expect(actionResponse).toEqual(expectedPayload);
});
- test('REMOVE_LAYER does nothing on non-existent id', () => {
+ test('REMOVE_LAYER does nothing on non-existent id [layers-action-remove-layer-no-id]', () => {
store.dispatch(removeLayer('INVALID TEST LAYER ID'));
const actionResponse = store.getActions()[0];
const expectedPayload = undefined;
expect(actionResponse).toEqual(expectedPayload);
});
- test('REMOVE_GROUP removes each layer in group', () => {
+ test('REMOVE_GROUP removes each layer in group [layers-action-remove-group]', () => {
store.dispatch(removeGroup(['terra-aod', 'aqua-aod']));
const actionResponse = store.getActions()[0];
const expectedPayload = {
@@ -99,7 +99,7 @@ describe('Layer actions', () => {
expect(actionResponse).toEqual(expectedPayload);
});
- test('TOGGLE_OVERLAY_GROUPS when grouped, toggling ungroups layers', () => {
+ test('TOGGLE_OVERLAY_GROUPS when grouped, toggling ungroups layers [layers-action-toggle-group]', () => {
store.dispatch(toggleOverlayGroups());
const actionResponse = store.getActions()[0];
const expectedPayload = {
diff --git a/web/js/modules/layers/reducers.test.js b/web/js/modules/layers/reducers.test.js
index 73e3e4dd1..9a8da9423 100644
--- a/web/js/modules/layers/reducers.test.js
+++ b/web/js/modules/layers/reducers.test.js
@@ -48,7 +48,7 @@ describe('layer Reducer tests', () => {
initialEventLayers = [];
});
- test('initial state has layers and overlayGroups as expected', () => {
+ test('initial state has layers and overlayGroups as expected [layers-reducer-initial-state]', () => {
expect(initialLayers.length).toEqual(3);
expect(initialLayers[0].id).toEqual('terra-aod');
expect(initialLayers[1].id).toEqual('aqua-cr');
@@ -66,7 +66,7 @@ describe('layer Reducer tests', () => {
expect(initialState.active.prevLayers.length).toEqual(0);
});
- test('Common actions update active layer array and groups', () => {
+ test('Common actions update active layer array and groups [layers-reducer-common-actions]', () => {
const actions = [
ADD_LAYER,
REORDER_LAYERS,
@@ -88,7 +88,7 @@ describe('layer Reducer tests', () => {
});
});
- test('Remove layer and group', () => {
+ test('Remove layer and group [layers-reducer-remove-layer]', () => {
const actions = [
REMOVE_LAYER,
REMOVE_GROUP,
@@ -110,7 +110,7 @@ describe('layer Reducer tests', () => {
});
});
- test('ADD_LAYERS_FOR_EVENT sets new groups, layers, and clears prevLayeers', () => {
+ test('ADD_LAYERS_FOR_EVENT sets new groups, layers, and clears prevLayeers [layers-reducer-add-layer-for-event]', () => {
const response = layerReducer(initialState, {
type: ADD_LAYERS_FOR_EVENT,
activeString: 'active',
@@ -123,7 +123,7 @@ describe('layer Reducer tests', () => {
expect(response.active.prevLayers).toEqual([]);
});
- test('REORDER_OVERLAY_GROUPS sets new groups, layers, and clears prevLayeers', () => {
+ test('REORDER_OVERLAY_GROUPS sets new groups, layers, and clears prevLayers [layers-reducer-reorder-overlay-groups]', () => {
const response = layerReducer(initialState, {
type: REORDER_OVERLAY_GROUPS,
activeString: 'active',
@@ -136,7 +136,7 @@ describe('layer Reducer tests', () => {
expect(response.active.prevLayers).toEqual([]);
});
- test('INIT_SECOND_LAYER_GROUP copies current layer state', () => {
+ test('INIT_SECOND_LAYER_GROUP copies current layer state [layers-reducer-second-layer-group]', () => {
const response = layerReducer(initialState, {
type: INIT_SECOND_LAYER_GROUP,
});
@@ -144,7 +144,7 @@ describe('layer Reducer tests', () => {
expect(initialState.active).toEqual(response.activeB);
});
- test('TOGGLE_LAYER_VISIBILITY action toggles layer state visibility', () => {
+ test('TOGGLE_LAYER_VISIBILITY action toggles layer state visibility [layers-reducer-toggle-visibility]', () => {
const response = layerReducer(initialState, {
type: TOGGLE_LAYER_VISIBILITY,
id: 'terra-cr',
@@ -155,7 +155,7 @@ describe('layer Reducer tests', () => {
expect(getTestLayer(response.active.layers).visible).toBeFalsy();
});
- test('TOGGLE_COLLAPSE_OVERLAY_GROUP toggles collapsed state of group', () => {
+ test('TOGGLE_COLLAPSE_OVERLAY_GROUP toggles collapsed state of group [layers-reducer-collapse-overlay-group]', () => {
const response = layerReducer(initialState, {
type: TOGGLE_COLLAPSE_OVERLAY_GROUP,
groupName: 'AOD',
@@ -166,7 +166,7 @@ describe('layer Reducer tests', () => {
expect(getTestGroup(response.active.overlayGroups)).toBeTruthy();
});
- test('TOGGLE_OVERLAY_GROUPS ungroups layers when grouped', () => {
+ test('TOGGLE_OVERLAY_GROUPS ungroups layers when grouped [layers-reducer-ungroup-layers]', () => {
const mockLayers = ['layer1', 'layer2', 'layer3'];
const response = layerReducer(initialState, {
type: TOGGLE_OVERLAY_GROUPS,
@@ -181,7 +181,7 @@ describe('layer Reducer tests', () => {
expect(response.active.prevLayers).toEqual(undefined);
});
- test('TOGGLE_OVERLAY_GROUPS groups layers when ungrouped', () => {
+ test('TOGGLE_OVERLAY_GROUPS groups layers when ungrouped [layers-reducer-group-layers]', () => {
const response = layerReducer(initialState, {
type: TOGGLE_OVERLAY_GROUPS,
activeString: 'active',
@@ -196,7 +196,7 @@ describe('layer Reducer tests', () => {
expect(response.active.prevLayers).toEqual(initialLayers);
});
- test('SET_THRESHOLD_RANGE_AND_SQUASH action updates palette-related props', () => {
+ test('SET_THRESHOLD_RANGE_AND_SQUASH action updates palette-related props [layers-reducer-update-palettes]', () => {
const response = layerReducer(initialState, {
type: SET_THRESHOLD_RANGE_AND_SQUASH,
props: { squash: true, min: 0.3 },
@@ -209,7 +209,7 @@ describe('layer Reducer tests', () => {
expect(responseLayer.min).toEqual(0.3);
});
- test('CLEAR_CUSTOM_PALETTE action removed custom value', () => {
+ test('CLEAR_CUSTOM_PALETTE action removed custom value [layers-reducer-clear-custom-palette]', () => {
const customInitial = update(initialState, {
active: {
layers: {
@@ -226,7 +226,7 @@ describe('layer Reducer tests', () => {
expect(getTestLayer(response.active.layers).custom).toEqual(undefined);
});
- test('SET_CUSTOM_PALETTE action removed custom value', () => {
+ test('SET_CUSTOM_PALETTE action removed custom value [layers-reducer-set-custom-palette]', () => {
const response = layerReducer(initialState, {
type: SET_CUSTOM_PALETTE,
id: 'terra-cr',
@@ -238,7 +238,7 @@ describe('layer Reducer tests', () => {
expect(getTestLayer(response.active.layers).custom).toEqual(['custom-id']);
});
- test('UPDATE_OPACITY action updates opacity for given layer', () => {
+ test('UPDATE_OPACITY action updates opacity for given layer [layers-reducer-update-opacity]', () => {
const response = layerReducer(initialState, {
type: UPDATE_OPACITY,
activeString: 'active',
diff --git a/web/js/modules/layers/util.test.js b/web/js/modules/layers/util.test.js
index ea59ff0e6..60d2c0479 100644
--- a/web/js/modules/layers/util.test.js
+++ b/web/js/modules/layers/util.test.js
@@ -27,65 +27,65 @@ const config = fixtures.config();
const PALETTE_LAYER_STRING = 'AMSRE_Brightness_Temp_89H_Night(hidden,opacity=0.54,palette=red_2,min=224,225,max=294,295,squash=true),mask';
const VECTOR_LAYER_STRING = 'OrbitTracks_Aqua_Ascending(hidden,opacity=0.46,style=yellow1),mask';
-test('Layer parser, retrieves correct number of palette layers from permalink string', () => {
+test('Layer parser, retrieves correct number of palette layers from permalink string [layers-palette-layers]', () => {
const layers = layersParse12(PALETTE_LAYER_STRING, config);
expect(layers.length).toBe(2);
});
-test('Layer parser, gets correct palette layer ID', () => {
+test('Layer parser, gets correct palette layer ID [layers-palette-layer-id]', () => {
const layers = layersParse12(PALETTE_LAYER_STRING, config);
const layer = layers[0];
expect(layer.id).toBe('AMSRE_Brightness_Temp_89H_Night');
});
-test('Layer parser, gets correct custom palette id from permalink string', () => {
+test('Layer parser, gets correct custom palette id from permalink string [layers-custom-palette-id]', () => {
const layers = layersParse12(PALETTE_LAYER_STRING, config);
const layer = layers[0];
expect(layer.custom[0]).toBe('red_2');
});
-test('Layer parser, gets squashed boolean from permalink string', () => {
+test('Layer parser, gets squashed boolean from permalink string [layers-squashed-boolean]', () => {
const layers = layersParse12(PALETTE_LAYER_STRING, config);
const layer = layers[0];
expect(layer.squash[0]).toBe(true);
});
-test('Layer parser, gets correct min value from permalink string', () => {
+test('Layer parser, gets correct min value from permalink string [layers-min-value]', () => {
const layers = layersParse12(PALETTE_LAYER_STRING, config);
const layer = layers[0];
expect(layer.min[0]).toBe(224);
});
-test('Layer parser, gets correct max value from permalink string', () => {
+test('Layer parser, gets correct max value from permalink string [layers-max-value]', () => {
const layers = layersParse12(PALETTE_LAYER_STRING, config);
const layer = layers[0];
expect(layer.max[0]).toBe(294);
});
-test('Layer parser, gets correct max value from permalink string', () => {
+test('Layer parser, gets correct max value from permalink string [layers-opacity-value]', () => {
const layers = layersParse12(PALETTE_LAYER_STRING, config);
const layer = layers[0];
expect(layer.opacity).toBe(0.54);
});
-test('Layer parser, retrieves hidden palette layer from permalink string', () => {
+test('Layer parser, retrieves hidden palette layer from permalink string [layers-hidden-palette-layer]', () => {
const layers = layersParse12(PALETTE_LAYER_STRING, config);
const layer = layers[0];
expect(layer.opacity).toBe(0.54);
});
-test('Layer parser, retrieves correct number of vector layers from permalink string', () => {
+test('Layer parser, retrieves correct number of vector layers from permalink string [layers-vector-layers]', () => {
const layers = layersParse12(VECTOR_LAYER_STRING, config);
expect(layers.length).toBe(2);
});
-test('Layer parser, gets correct vector layer ID', () => {
+test('Layer parser, gets correct vector layer ID [layers-vector-layer-id]', () => {
const layers = layersParse12(VECTOR_LAYER_STRING, config);
const layer = layers[0];
expect(layer.id).toBe('OrbitTracks_Aqua_Ascending');
});
-test('Layer parser, gets correct custom vector style id from permalink string', () => {
+test('Layer parser, gets correct custom vector style id from permalink string [layers-vector-style-id]', () => {
const layers = layersParse12(VECTOR_LAYER_STRING, config);
const layer = layers[0];
expect(layer.custom[0]).toBe('yellow1');
});
-test('Layer parser, retrieves hidden vector layer from permalink string', () => {
+test('Layer parser, retrieves hidden vector layer from permalink string [layers-hidden-vector-layer]', () => {
const layers = layersParse12(VECTOR_LAYER_STRING, config);
const layer = layers[0];
expect(layer.opacity).toBe(0.46);
});
-test('serialize layers and palettes', () => {
+test('serialize layers and palettes [layers-serialize]', () => {
const terraAodLayer = config.layers['terra-aod'];
const paletteState = {
palettes: {
@@ -116,7 +116,7 @@ describe('permalink 1.0', () => {
},
};
});
- test('supports old style period delimiters', () => {
+ test('supports old style period delimiters [layers-old-style-delimiters]', () => {
const parameters = {
products: 'baselayers.terra-cr~overlays.terra-aod.aqua-aod',
};
@@ -149,7 +149,7 @@ describe('permalink 1.1', () => {
};
});
- test('parses only one baselayer', () => {
+ test('parses only one baselayer [layers-parse-one-baselayer]', () => {
const parameters = {
products: 'baselayers,terra-cr',
};
@@ -162,7 +162,7 @@ describe('permalink 1.1', () => {
);
expect(stateFromLocation.layers.active.layers[0].id).toBe('terra-cr');
});
- test('parses only one overlay', () => {
+ test('parses only one overlay [layers-parse-one-overlay]', () => {
const parameters = {
products: 'overlays,terra-aod',
};
@@ -175,7 +175,7 @@ describe('permalink 1.1', () => {
expect(stateFromLocation.layers.active.layers[0].id).toBe('terra-aod');
});
- test('parses multiple layers', () => {
+ test('parses multiple layers [layers-parse-multiple-layers]', () => {
const parameters = {
products: 'baselayers,terra-cr~overlays,terra-aod,aqua-aod',
};
@@ -190,7 +190,7 @@ describe('permalink 1.1', () => {
expect(activeLayers.find((x) => x.id === 'terra-aod')).toBeTruthy();
expect(activeLayers.find((x) => x.id === 'aqua-aod')).toBeTruthy();
});
- test('empty layer list', () => {
+ test('empty layer list [layers-empty-list]', () => {
const parameters = {
products: 'baselayers~overlays',
};
@@ -203,7 +203,7 @@ describe('permalink 1.1', () => {
const activeLayers = stateFromLocation.layers.active.layers;
expect(activeLayers).toHaveLength(0);
});
- test('skips invalid layers and records an error', () => {
+ test('skips invalid layers and records an error [layers-skip-invalid-layers]', () => {
const parameters = {
products: 'baselayers,terra-cr~overlays,layerx,aqua-aod',
};
@@ -217,7 +217,7 @@ describe('permalink 1.1', () => {
expect(activeLayers.find((x) => x.id === 'terra-cr')).toBeTruthy();
expect(activeLayers.find((x) => x.id === 'aqua-aod')).toBeTruthy();
});
- test('no layers if no groups found', () => {
+ test('no layers if no groups found [layers-no-group-found]', () => {
const parameters = {
products: 'layerx,layery',
};
@@ -230,7 +230,7 @@ describe('permalink 1.1', () => {
const activeLayers = stateFromLocation.layers.active.layers;
expect(activeLayers).toHaveLength(0);
});
- test('hidden layers', () => {
+ test('hidden layers [layers-hidden-layers]', () => {
const parameters = {
products: 'baselayers,!terra-cr',
};
@@ -261,7 +261,7 @@ describe('Date range building', () => {
};
});
- test('test active multi-day layers are extending beyond known GC end date using adjustActiveDateRanges', () => {
+ test('test active multi-day layers are extending beyond known GC end date using adjustActiveDateRanges [layers-adjust-date-ranges]', () => {
const parameters = {
products: 'MODIS_Combined_L4_LAI_4Day',
};
@@ -278,7 +278,7 @@ describe('Date range building', () => {
expect(dateRanges.length).toBe(4);
expect(dateRanges[3].endDate).toBe('2021-04-30T16:00:00Z');
});
- test('test limited date range returned for layer with single date range and interval', () => {
+ test('test limited date range returned for layer with single date range and interval [layers-limited-date-range]', () => {
const parameters = {
products: 'terra-cr',
};
@@ -293,7 +293,7 @@ describe('Date range building', () => {
const dates = datesInDateRanges(activeLayers[0], new Date('2020-01-01'));
expect(dates.length).toBe(3);
});
- test('test only next date returned (out of range past)', () => {
+ test('test only next date returned (out of range past) [layers-out-of-range-past]', () => {
const parameters = {
products: 'terra-cr',
};
@@ -308,7 +308,7 @@ describe('Date range building', () => {
const dates = datesInDateRanges(activeLayers[0], new Date('1990-01-01'));
expect(dates.length).toBe(1);
});
- test('test no dates returned (out of range future)', () => {
+ test('test no dates returned (out of range future) [layers-out-of-range-future]', () => {
const parameters = {
products: 'terra-cr',
};
@@ -323,7 +323,7 @@ describe('Date range building', () => {
const dates = datesInDateRanges(activeLayers[0], new Date('2030-01-01'));
expect(dates.length).toBe(0);
});
- test('test date range returned from given start/end date range for layer coverage panel', () => {
+ test('test date range returned from given start/end date range for layer coverage panel [layers-coverage-panel]', () => {
const parameters = {
products: 'terra-cr',
};
@@ -362,7 +362,7 @@ describe('Vector layers', () => {
breakPointLayer,
},
];
- test('isVectorLayerClickable func', () => {
+ test('isVectorLayerClickable func [layers-vector-layer-clickable]', () => {
const false1 = isVectorLayerClickable({
type: 'vector',
}, null, 'geographic');
@@ -393,14 +393,14 @@ describe('Vector layers', () => {
expect(trueArctic).toBe(true);
expect(true1).toBe(true);
});
- test('hasNonClickableVectorLayer func', () => {
+ test('hasNonClickableVectorLayer func [layers-nonclickable-vector-layer]', () => {
const false1 = hasNonClickableVectorLayer(layers, 0.1, 'geographic');
const true1 = hasNonClickableVectorLayer(layers, 0.3, 'geographic');
expect(false1).toBe(false);
expect(true1).toBe(true);
});
- test('hasVectorLayers func', () => {
+ test('hasVectorLayers func [layers-has-vector-layers]', () => {
const false1 = hasVectorLayers([{ type: 'wms', visible: true }], 0.1);
const false2 = hasVectorLayers([{ type: 'vector', visible: false }], 0.1);
const true1 = hasVectorLayers(layers);
diff --git a/web/js/modules/link/actions.test.js b/web/js/modules/link/actions.test.js
index 5c251e2db..68c4e4f0c 100644
--- a/web/js/modules/link/actions.test.js
+++ b/web/js/modules/link/actions.test.js
@@ -21,7 +21,7 @@ describe('Short Link request action', () => {
test(
`creates ${
constants.REQUEST_SHORT_LINK_SUCESSS
- } when short link is complete`,
+ } when short link is complete [link-actions-request-short-link]`,
() => {
const loc = 'mock/';
fetchMock.getOnce(loc, {
@@ -47,7 +47,7 @@ describe('Short Link request action', () => {
});
},
);
- test(`creates ${constants.REQUEST_SHORT_LINK_FAILURE} Action`, () => {
+ test(`creates ${constants.REQUEST_SHORT_LINK_FAILURE} Action [link-actions-failure]`, () => {
const loc = 'mock/';
fetchMock.mock(loc, {
throws: ERROR_MESSAGE,
@@ -69,7 +69,7 @@ describe('Short Link request action', () => {
});
describe('updatePermalink action', () => {
test(
- `${constants.UPDATE_PERMALINK} action type returns new permalink`,
+ `${constants.UPDATE_PERMALINK} action type returns new permalink [link-actions-update-permalink]`,
() => {
const testString = 'thisIsATestString';
const expectedAction = {
diff --git a/web/js/modules/link/reducers.test.js b/web/js/modules/link/reducers.test.js
index 19749a917..84faf01cf 100644
--- a/web/js/modules/link/reducers.test.js
+++ b/web/js/modules/link/reducers.test.js
@@ -3,7 +3,7 @@ import * as constants from './constants';
import { defaultRequestState } from '../core/reducers';
describe('shortLink reducer', () => {
- test('should return the initial state', () => {
+ test('should return the initial state [link-reducer-initial-state]', () => {
expect(shortLink([], {})).toEqual(defaultRequestState);
});
test('Should set isLoading to true on Request Start', () => {
@@ -18,7 +18,7 @@ describe('shortLink reducer', () => {
type: null,
});
});
- test('Should return response upon request success ', () => {
+ test('Should return response upon request success [link-reducer-success-response]', () => {
expect(
shortLink([], {
type: constants.REQUEST_SHORT_LINK_SUCCESS,
@@ -33,12 +33,12 @@ describe('shortLink reducer', () => {
});
});
describe('linkReducer', () => {
- test('should return the initial state', () => {
+ test('should return the initial state [link-reducer-return-initial-state]', () => {
expect(linkReducer(undefined, {})).toEqual(defaultLinkState);
});
test(
`${constants.UPDATE_PERMALINK
- }action type should return object containing sorted mock object`,
+ }action type should return object containing sorted mock object [link-reducer-mock-object]`,
() => {
const testString = 'thisIsATestString';
expect(
diff --git a/web/js/modules/location-search/actions.test.js b/web/js/modules/location-search/actions.test.js
index 17c570782..5403f0182 100644
--- a/web/js/modules/location-search/actions.test.js
+++ b/web/js/modules/location-search/actions.test.js
@@ -26,7 +26,7 @@ const suggestion = [{
describe('Location Search actions', () => {
test(`toggleShowLocationSearch action returns ${TOGGLE_SHOW_LOCATION_SEARCH} as type and ${
- !isExpanded} as value`, () => {
+ !isExpanded} as value [locationsearch-actions-toggle]`, () => {
const expectedAction = {
type: TOGGLE_SHOW_LOCATION_SEARCH,
value: false,
@@ -40,14 +40,14 @@ describe('Location Search actions', () => {
expect(store.getActions()[0]).toEqual(expectedAction);
});
test(`toggleReverseGeocodeActive action returns ${TOGGLE_REVERSE_GEOCODE} as type and ${
- true} as value`, () => {
+ true} as value [locationsearch-actions-reverse-geocode]`, () => {
const expectedAction = {
type: TOGGLE_REVERSE_GEOCODE,
value: true,
};
expect(toggleReverseGeocodeActive(true)).toEqual(expectedAction);
});
- test(`setSuggestion action returns ${SET_SUGGESTION} as type and ${suggestion} as value`, () => {
+ test(`setSuggestion action returns ${SET_SUGGESTION} as type and ${suggestion} as value [locationsearch-actions-set-suggestion]`, () => {
const expectedAction = {
type: SET_SUGGESTION,
value: suggestion,
@@ -60,7 +60,7 @@ describe('Location Search actions', () => {
store.dispatch(setSuggestion(suggestion));
expect(store.getActions()[0]).toEqual(expectedAction);
});
- test(`clearSuggestions action returns ${CLEAR_SUGGESTIONS} as type and ${[]} as value`, () => {
+ test(`clearSuggestions action returns ${CLEAR_SUGGESTIONS} as type and ${[]} as value [locationsearch-actions-clear-suggestions]`, () => {
const expectedAction = {
type: CLEAR_SUGGESTIONS,
value: [],
diff --git a/web/js/modules/location-search/reducers.test.js b/web/js/modules/location-search/reducers.test.js
index 89cfa7fd7..287965d4e 100644
--- a/web/js/modules/location-search/reducers.test.js
+++ b/web/js/modules/location-search/reducers.test.js
@@ -23,7 +23,7 @@ const suggestion = [{
const coordinatesObject = { id: 1234, latitude: 72, longitude: 40 };
describe('locationSearch', () => {
- test('locationSearch should return the initial state', () => {
+ test('locationSearch should return the initial state [locationstate-reducer-initial-state]', () => {
expect(locationSearchReducer(undefined, {})).toEqual(
locationSearchState,
);
@@ -31,7 +31,7 @@ describe('locationSearch', () => {
test(
`${TOGGLE_SHOW_LOCATION_SEARCH
} shows Location Search isExpanded and `
- + 'should return new state',
+ + 'should return new state [locationsearch-reducer-toggle]',
() => {
expect(
locationSearchReducer(locationSearchState, {
@@ -47,7 +47,7 @@ describe('locationSearch', () => {
test(
`${TOGGLE_REVERSE_GEOCODE
} toggles isCoordinateSearchActive to true and `
- + 'should return new state',
+ + 'should return new state [locationsearch-reducer-reverse-geocode]',
() => {
expect(
locationSearchReducer(locationSearchState, {
@@ -63,7 +63,7 @@ describe('locationSearch', () => {
test(
`${SET_MARKER
} updates coordinates, reverseGeocodeResults `
- + 'and sets isCoordinateSearchActive to false and should return new state',
+ + 'and sets isCoordinateSearchActive to false and should return new state [locationsearch-reducer-set-marker]',
() => {
expect(
locationSearchReducer(locationSearchState, {
@@ -82,7 +82,7 @@ describe('locationSearch', () => {
test(
`${SET_SUGGESTION
} updates suggestions with value and `
- + 'should return new state',
+ + 'should return new state [locationsearch-reducer-set-suggestion]',
() => {
expect(
locationSearchReducer(locationSearchState, {
@@ -98,7 +98,7 @@ describe('locationSearch', () => {
test(
`${CLEAR_SUGGESTIONS
} updates suggestions and suggestedPlace with clear value and `
- + 'should return new state',
+ + 'should return new state [locationsearch-reducer-clear-suggestion]',
() => {
expect(
locationSearchReducer(locationSearchState, {
diff --git a/web/js/modules/modal/actions.test.js b/web/js/modules/modal/actions.test.js
index b31ee0111..f773690b4 100644
--- a/web/js/modules/modal/actions.test.js
+++ b/web/js/modules/modal/actions.test.js
@@ -24,7 +24,7 @@ describe('Modal open actions', () => {
test(
`openBasicContent action returns ${
constants.OPEN_BASIC
- }header text, body text and encode key`,
+ }header text, body text and encode key [modal-actions-open]`,
() => {
const expectedAction = {
type: constants.OPEN_BASIC,
@@ -38,7 +38,7 @@ describe('Modal open actions', () => {
},
);
- test(`onToggle action returns ${constants.TOGGLE}as type`, () => {
+ test(`onToggle action returns ${constants.TOGGLE}as type [modal-actions-toggle]`, () => {
const expectedAction = {
type: constants.TOGGLE,
};
@@ -48,7 +48,7 @@ describe('Modal open actions', () => {
test(
`openCustomContent action returns ${
constants.OPEN_CUSTOM
- } action type`,
+ } action type [modal-actions-open-custom]`,
() => {
const customsKey = 'CUSTOM_MODAL_KEY';
const customsParams = {
@@ -69,7 +69,7 @@ describe('Modal open actions', () => {
);
test(
- `renderTemplate action returns ${constants.RENDER_TEMPLATE} type, `,
+ `renderTemplate action returns ${constants.RENDER_TEMPLATE} type [modal-actions-render-template]`,
() => {
const templateModalKey = 'somePageName';
@@ -89,7 +89,7 @@ describe('Template fetching', () => {
afterEach(() => {
fetchMock.restore();
});
- test('triggers start and success action types', () => {
+ test('triggers start and success action types [modal-actions-success]', () => {
const loc = 'mock/';
fetchMock.getOnce(loc, {
body: constants.ABOUT_MOCK_RESPONSE,
@@ -113,7 +113,7 @@ describe('Template fetching', () => {
expect(store.getActions()).toEqual(expectedActions);
});
});
- test(`creates ${constants.TEMPLATE_REQUEST_FAILURE} Action`, () => {
+ test(`creates ${constants.TEMPLATE_REQUEST_FAILURE} Action [modal-actions-failure]`, () => {
const loc = 'mock/';
fetchMock.mock(loc, {
throws: ERROR_MESSAGE,
diff --git a/web/js/modules/modal/reducers.test.js b/web/js/modules/modal/reducers.test.js
index 6088bbac1..2b4416ef6 100644
--- a/web/js/modules/modal/reducers.test.js
+++ b/web/js/modules/modal/reducers.test.js
@@ -7,7 +7,7 @@ describe('main modalReducer', () => {
test('should return the initial state', () => {
expect(modalReducer(undefined, {})).toEqual(modalState);
});
- test(`${constants.TOGGLE}action type should toggle open value`, () => {
+ test(`${constants.TOGGLE}action type should toggle open value [modal-reducer-toggle]`, () => {
const modalToggledOpenObj = { isOpen: true };
expect(
modalReducer([], {
@@ -16,7 +16,7 @@ describe('main modalReducer', () => {
).toEqual(modalToggledOpenObj);
});
test(
- `${constants.OPEN_BASIC}action type should update various modal props`,
+ `${constants.OPEN_BASIC}action type should update various modal props [modal-reducer-open]`,
() => {
const basicOpenModalObject = {
isOpen: true,
@@ -39,7 +39,7 @@ describe('main modalReducer', () => {
},
);
test(
- `${constants.OPEN_CUSTOM} action type should update various modal props`,
+ `${constants.OPEN_CUSTOM} action type should update various modal props [modal-reducer-open-custom]`,
() => {
const customProps = { id: 'tester' };
const modalCustomObject = lodashAssign({}, modalState, {
@@ -60,7 +60,7 @@ describe('main modalReducer', () => {
);
test(
`${constants.RENDER_TEMPLATE
- } action type should update various modal props`,
+ } action type should update various modal props [modal-reducer-render-template]`,
() => {
const template = '<html>';
const modalCustomObject = lodashAssign({}, modalState, {
diff --git a/web/js/modules/natural-events/util.test.js b/web/js/modules/natural-events/util.test.js
index a6c77eddd..fefaf6395 100644
--- a/web/js/modules/natural-events/util.test.js
+++ b/web/js/modules/natural-events/util.test.js
@@ -41,24 +41,24 @@ const updateProjState = (newState, state) => ({
},
});
-test('Request URL with grographic proj and no bbox', () => {
+test('Request URL with grographic proj and no bbox [naturalevents-geo-proj-no-bbox]', () => {
const requestURL = getEventsRequestURL(initialState);
expect(requestURL).toBe('fake.eonet.url/api/events?status=all&limit=50&bbox=-180%2C90%2C180%2C-90&start=2020-01-01&end=2021-01-01&category=snow%2Cwildfires%2Cmanmade');
});
-test('Request URL with grographic proj and bbox set', () => {
+test('Request URL with grographic proj and bbox set [naturalevents-geo-proj-bbox]', () => {
const state = updateEventState({ showAll: false }, initialState);
const requestURL = getEventsRequestURL(state);
expect(requestURL).toBe('fake.eonet.url/api/events?status=all&limit=50&bbox=-15.06%2C27.16%2C13.32%2C56.06&start=2020-01-01&end=2021-01-01&category=snow%2Cwildfires%2Cmanmade');
});
-test('Request URL doesn\'t include categories param if none set', () => {
+test('Request URL doesn\'t include categories param if none set [naturalevents-categories-param]', () => {
const state = updateEventState({ selectedCategories: [] }, initialState);
const requestURL = getEventsRequestURL(state);
expect(requestURL).toBe('fake.eonet.url/api/events?status=all&limit=50&bbox=-180%2C90%2C180%2C-90&start=2020-01-01&end=2021-01-01');
});
-test('Uses mock events if mockEvents param is present', () => {
+test('Uses mock events if mockEvents param is present [naturalevents-mock-events]', () => {
const state = {
...initialState,
config: {
@@ -72,7 +72,7 @@ test('Uses mock events if mockEvents param is present', () => {
expect(requestURL).toBe('mock/events_data.json');
});
-test('Request URL with polar proj uses default bbox', () => {
+test('Request URL with polar proj uses default bbox [naturalevents-polar-proj]', () => {
let state = updateProjState(mockProj.arctic, initialState);
state = updateEventState({
showAll: false,
diff --git a/web/js/modules/notifications/actions.test.js b/web/js/modules/notifications/actions.test.js
index 21746a058..02b858072 100644
--- a/web/js/modules/notifications/actions.test.js
+++ b/web/js/modules/notifications/actions.test.js
@@ -16,7 +16,7 @@ describe('Notification fetch action', () => {
afterEach(() => {
fetchMock.restore();
});
- test('triggers start and success action types', () => {
+ test('triggers start and success action types [notifications-actions-success]', () => {
const loc = 'mock/';
fetchMock.getOnce(loc, {
body: constants.MOCK_RESPONSE,
@@ -40,7 +40,7 @@ describe('Notification fetch action', () => {
expect(store.getActions()).toEqual(expectedActions);
});
});
- test(`creates ${constants.REQUEST_NOTIFICATIONS_FAILURE} Action`, () => {
+ test(`creates ${constants.REQUEST_NOTIFICATIONS_FAILURE} Action [notifications-actions-failure]`, () => {
const loc = 'mock/';
fetchMock.mock(loc, {
throws: ERROR_MESSAGE,
@@ -60,7 +60,7 @@ describe('Notification fetch action', () => {
});
});
});
-describe('Notification post-request actions', () => {
+describe('Notification post-request actions [notifications-actions-post-request]', () => {
test(
`setNotification action returns ${
constants.SET_NOTIFICATIONS
@@ -78,7 +78,7 @@ describe('Notification post-request actions', () => {
test(
`notificationsSeen action returns ${
constants.NOTIFICATIONS_SEEN
- } action type`,
+ } action type [notifications-actions-seen]`,
() => {
const expectedAction = {
type: constants.NOTIFICATIONS_SEEN,
diff --git a/web/js/modules/notifications/reducers.test.js b/web/js/modules/notifications/reducers.test.js
index 73365aa04..0269b4ed1 100644
--- a/web/js/modules/notifications/reducers.test.js
+++ b/web/js/modules/notifications/reducers.test.js
@@ -10,7 +10,7 @@ describe('notificationsRequest reducer', () => {
test('should return the initial state', () => {
expect(notificationsRequest([], {})).toEqual(defaultRequestState);
});
- test('Should set isLoading to true on Request Start', () => {
+ test('Should set isLoading to true on Request Start [notifications-reducer-loading]', () => {
expect(
notificationsRequest([], {
type: constants.REQUEST_NOTIFICATIONS_START,
@@ -22,7 +22,7 @@ describe('notificationsRequest reducer', () => {
type: null,
});
});
- test('Should return response upon request success ', () => {
+ test('Should return response upon request success [notifications-reducer-success]', () => {
expect(
notificationsRequest([], {
type: constants.REQUEST_NOTIFICATIONS_SUCCESS,
@@ -37,14 +37,14 @@ describe('notificationsRequest reducer', () => {
});
});
describe('notificationsReducer', () => {
- test('should return the initial state', () => {
+ test('should return the initial state [notifications-reducer-initial-state]', () => {
expect(notificationsReducer(undefined, {})).toEqual(
notificationReducerState,
);
});
test(
`${constants.SET_NOTIFICATIONS
- } action type should return object containing sorted mock object`,
+ } action type should return object containing sorted mock object [notification-reducer-mock-object]`,
() => {
expect(
notificationsReducer([], {
@@ -62,7 +62,7 @@ describe('notificationsReducer', () => {
);
test(
`${constants.SET_NOTIFICATIONS
- } action type should return object containing sorted mock object`,
+ } action type should return object containing sorted mock object [notification-reducer-mock-object-seen]`,
() => {
expect(
notificationsReducer(notificationReducerState, {
diff --git a/web/js/modules/palettes/actions.test.js b/web/js/modules/palettes/actions.test.js
index d62c300a6..79aa1d8ed 100644
--- a/web/js/modules/palettes/actions.test.js
+++ b/web/js/modules/palettes/actions.test.js
@@ -31,7 +31,7 @@ const state = fixtures.getState();
const config = fixtures.config();
const ERROR_MESSAGE = 'There was an error';
-describe('Palette terra-aod fetching with requestPalette action', () => {
+describe('Palette terra-aod fetching with requestPalette action [palettes-actions-request-palette]', () => {
const mockStore = configureMockStore(middlewares);
afterEach(() => {
fetchMock.restore();
@@ -59,7 +59,7 @@ describe('Palette terra-aod fetching with requestPalette action', () => {
expect(store.getActions()).toEqual(expectedActions);
});
});
- test(`Test ${REQUEST_PALETTE_FAILURE}`, () => {
+ test(`Test ${REQUEST_PALETTE_FAILURE} [palettes-actions-failure]`, () => {
fetchMock.mock(loc, {
throws: ERROR_MESSAGE,
});
@@ -77,7 +77,7 @@ describe('Palette terra-aod fetching with requestPalette action', () => {
});
});
});
-describe('Test lookup actions', () => {
+describe('Test lookup actions [palettes-actions-lookup]', () => {
const mockStore = configureMockStore(middlewares);
let layers = addLayer('terra-aod', {}, [], config.layers, 0);
layers = addLayer('aqua-cr', {}, layers, config.layers, 1);
@@ -109,7 +109,7 @@ describe('Test lookup actions', () => {
config.palettes.lookups['terra-aod']['min-1'],
);
});
- test(`test ${setThresholdRangeAndSquash} action with squash and max`, () => {
+ test(`test ${setThresholdRangeAndSquash} action with squash and max [palettes-actions-threshold]`, () => {
const store = mockStore(stateWithLayers);
store.dispatch(
setThresholdRangeAndSquash('terra-aod', { max: 1, squash: true }, 0, 'active'),
@@ -132,7 +132,7 @@ describe('Test lookup actions', () => {
config.palettes.lookups['terra-aod']['max-1-squashed'],
);
});
- test(`test ${setCustomPalette} action with red-1 fixture palette`, () => {
+ test(`test ${setCustomPalette} action with red-1 fixture palette [palettes-actions-set-custom]`, () => {
const expectedLegendColors = config.palettes.custom['red-1'].colors;
const store = mockStore(stateWithLayers);
store.dispatch(setCustomPalette('terra-aod', 'red-1', 0, 'active'));
@@ -151,7 +151,7 @@ describe('Test lookup actions', () => {
config.palettes.lookups['terra-aod']['red-1'],
);
});
- test(`test ${clearCustomPalette} action when no threshold applied`, () => {
+ test(`test ${clearCustomPalette} action when no threshold applied [palettes-actions-clear-custom]`, () => {
let terraAOD = assign({}, config.palettes.rendered['terra-aod']);
terraAOD = update(terraAOD, {
lookup: { $set: config.palettes.lookups['terra-aod']['red-1'] },
@@ -191,7 +191,7 @@ describe('Test lookup actions', () => {
expect(response.activeString).toEqual('active');
});
test(
- `test ${clearCustomPalette} action with threshold and squash applied`,
+ `test ${clearCustomPalette} action with threshold and squash applied [palettes-actions-clear-custom-threshold]`,
() => {
let terraAOD = assign({}, config.palettes.rendered['terra-aod']);
terraAOD = update(terraAOD, {
diff --git a/web/js/modules/palettes/reducers.test.js b/web/js/modules/palettes/reducers.test.js
index eccebd5c7..c249ba45f 100644
--- a/web/js/modules/palettes/reducers.test.js
+++ b/web/js/modules/palettes/reducers.test.js
@@ -13,7 +13,7 @@ import { INIT_SECOND_LAYER_GROUP } from '../layers/constants';
const config = fixtures.config();
-test('SET_THRESHOLD_RANGE_AND_SQUASH action updates active palette Object', () => {
+test('SET_THRESHOLD_RANGE_AND_SQUASH action updates active palette Object [palettes-reducer-threshold]', () => {
const initialPaletteState = getInitialPaletteState(config);
const response = paletteReducer(initialPaletteState, {
type: SET_THRESHOLD_RANGE_AND_SQUASH,
@@ -25,7 +25,7 @@ test('SET_THRESHOLD_RANGE_AND_SQUASH action updates active palette Object', () =
expect(response.active['terra-aod']).toBeDefined();
});
-test('CLEAR_CUSTOM action updates active palette Object', () => {
+test('CLEAR_CUSTOM action updates active palette Object [palettes-reducer-clear-custom]', () => {
const initialPaletteState = getInitialPaletteState(config);
const response = paletteReducer(initialPaletteState, {
type: CLEAR_CUSTOM,
@@ -36,7 +36,7 @@ test('CLEAR_CUSTOM action updates active palette Object', () => {
expect(initialPaletteState.active['terra-aod']).toEqual(undefined);
expect(response.active['terra-aod']).toBeDefined();
});
-test('SET_CUSTOM action updates active palette Object', () => {
+test('SET_CUSTOM action updates active palette Object [palettes-reducer-set-custom]', () => {
const initialPaletteState = getInitialPaletteState(config);
const response = paletteReducer(initialPaletteState, {
type: SET_CUSTOM,
@@ -47,7 +47,7 @@ test('SET_CUSTOM action updates active palette Object', () => {
expect(initialPaletteState.active['terra-aod']).toEqual(undefined);
expect(response.active['terra-aod']).toBeDefined();
});
-test('INIT_SECOND_LAYER_GROUP action updates active palette Object', () => {
+test('INIT_SECOND_LAYER_GROUP action updates active palette Object [palettes-reducer-second-layer-group]', () => {
const initialPaletteState = getInitialPaletteState(config);
const previousState = update(initialPaletteState, {
active: { $set: { test: 'tests' } },
@@ -61,7 +61,7 @@ test('INIT_SECOND_LAYER_GROUP action updates active palette Object', () => {
expect(previousState.activeB.test).toBeUndefined();
expect(response.activeB.test).toEqual('tests');
});
-test('REQUEST_PALETTE_START action updates active palette Object', () => {
+test('REQUEST_PALETTE_START action updates active palette Object [palettes-reducer-request-palette]', () => {
const initialPaletteState = getInitialPaletteState(config);
const response = paletteReducer(initialPaletteState, {
type: REQUEST_PALETTE_START,
@@ -70,7 +70,7 @@ test('REQUEST_PALETTE_START action updates active palette Object', () => {
expect(initialPaletteState.isLoading.test).toBeUndefined();
expect(response.isLoading.test).toBeTruthy();
});
-test('REQUEST_PALETTE_SUCCESS action updates active palette Object', () => {
+test('REQUEST_PALETTE_SUCCESS action updates active palette Object [palettes-reducer-success]', () => {
const initialPaletteState = getInitialPaletteState(config);
const response = paletteReducer(initialPaletteState, {
type: REQUEST_PALETTE_SUCCESS,
@@ -81,7 +81,7 @@ test('REQUEST_PALETTE_SUCCESS action updates active palette Object', () => {
expect(response.rendered.test).toEqual('test-response');
});
-test('BULK_PALETTE_RENDERING_SUCCESS action merges rendered palettes with new palettes from action', () => {
+test('BULK_PALETTE_RENDERING_SUCCESS action merges rendered palettes with new palettes from action [palettes-reducer-bulk-render]', () => {
const initialPaletteState = getInitialPaletteState(config);
const updatedState = update(initialPaletteState, {
rendered: { $set: { 'test-1': 'test-1' } },
diff --git a/web/js/modules/palettes/util.test.js b/web/js/modules/palettes/util.test.js
index 96d3f9d62..913a888ac 100644
--- a/web/js/modules/palettes/util.test.js
+++ b/web/js/modules/palettes/util.test.js
@@ -13,21 +13,21 @@ const LAYER_STRING = 'terra-aod(hidden,opacity=0.54,palette=red-1,min=1,max=2,sq
const layerArrayFromPermalinkString = layersParse12(LAYER_STRING, config);
const PERMALINK_STATE = { l: LAYER_STRING };
-test('hasCustomTypePalette func determines if custom palette is in string', () => {
+test('hasCustomTypePalette func determines if custom palette is in string [palettes-custom-palette-string-1.1]', () => {
const bool = hasCustomTypePalette(
'terra-aod(hidden,opacity=0.54,palette=red-1,min=1,max=2,squash=true)',
);
expect(bool).toBeTruthy();
});
-test('hasCustomTypePalette func determines if custom palette is in string', () => {
+test('hasCustomTypePalette func determines if custom palette is in string [palettes-custom-palette-string-1.2', () => {
const bool = hasCustomTypePalette(
'some-layer(disabled(;0-2)',
);
expect(bool).toBeTruthy();
});
-test('loadPalettes func updates state with correct palette attributes', () => {
+test('loadPalettes func updates state with correct palette attributes [palettes-load-palettes]', () => {
const updatedState = update(state, {
layers: {
active: {
@@ -45,7 +45,7 @@ test('loadPalettes func updates state with correct palette attributes', () => {
});
describe('permalink 1.1', () => {
- test('parses palette for valid layer', () => {
+ test('parses palette for valid layer [palettes-parse-permalink]', () => {
const parameters = {
l: 'terra-aod',
palettes: 'terra-aod,blue-1',
@@ -69,7 +69,7 @@ describe('permalink 1.1', () => {
expect(layer.custom).toBe('blue-1');
});
- test('parses palette for two valid layers', () => {
+ test('parses palette for two valid layers [palettes-parse-palette]', () => {
const parameters = {
l: 'terra-aod,aqua-aod',
palettes: 'terra-aod,blue-1~aqua-aod,red-1',
@@ -97,7 +97,7 @@ describe('permalink 1.1', () => {
expect(layer2.custom).toBe('red-1');
});
- test('disregard palettes value if palette assigned to a layer that is not active', () => {
+ test('disregard palettes value if palette assigned to a layer that is not active [palettes-ignore-palettes]', () => {
const parameters = {
l: 'terra-aod',
palettes: 'aqua-aod,red-1',
diff --git a/web/js/modules/projection/util.test.js b/web/js/modules/projection/util.test.js
index eb5f30a1b..2182ea17c 100644
--- a/web/js/modules/projection/util.test.js
+++ b/web/js/modules/projection/util.test.js
@@ -14,7 +14,7 @@ const config = {
'some-test-projection': proj,
},
};
-test('getProjInitialState with given projeciton', () => {
+test('getProjInitialState with given projeciton [projection-initial-state]', () => {
const response = {
id: 'some-test-projection',
selected: proj,
@@ -23,7 +23,7 @@ test('getProjInitialState with given projeciton', () => {
expect(initialState.id).toBe(response.id);
expect(initialState.selected.id).toBe(response.selected.id);
});
-test('Default proj should be geographic', () => {
+test('Default proj should be geographic [projection-default-geographic]', () => {
const emptyConfig = {
defaults: {},
};
@@ -34,7 +34,7 @@ test('Default proj should be geographic', () => {
const initialState = getProjInitialState(emptyConfig);
expect(initialState.id).toBe(response.id);
});
-test('mapLocationToProjState: Update proj:id key onload', () => {
+test('mapLocationToProjState: Update proj:id key onload [projection-update-id]', () => {
const state = {
config,
proj: {
@@ -48,7 +48,7 @@ test('mapLocationToProjState: Update proj:id key onload', () => {
expect(newState.proj.id).toBe('some-test-projection');
});
-test('legacy switch parameter for projection', () => {
+test('legacy switch parameter for projection [projection-legacy-switch]', () => {
const param = {
switch: 'some-test-projection',
};
diff --git a/web/js/modules/vector-styles/action.test.js b/web/js/modules/vector-styles/action.test.js
index 12beb4b3f..7abfaa21a 100644
--- a/web/js/modules/vector-styles/action.test.js
+++ b/web/js/modules/vector-styles/action.test.js
@@ -2,7 +2,7 @@ import { SET_SELECTED_VECTORS } from './constants';
import { selectVectorFeatures } from './actions';
test(
- `selectVectorFeature action returns ${SET_SELECTED_VECTORS} action type`,
+ `selectVectorFeature action returns ${SET_SELECTED_VECTORS} action type [vectorstyles-actions-set-selected]`,
() => {
const payload = 'test';
const expectedAction = {
diff --git a/web/js/modules/vector-styles/reducer.test.js b/web/js/modules/vector-styles/reducer.test.js
index 0b4137c52..0b70b484a 100644
--- a/web/js/modules/vector-styles/reducer.test.js
+++ b/web/js/modules/vector-styles/reducer.test.js
@@ -1,7 +1,7 @@
import { defaultVectorStyleState, vectorStyleReducer } from './reducers';
import { SET_SELECTED_VECTORS } from './constants';
-test('Set a selected Vector', () => {
+test('Set a selected Vector [vectorstyle-reducer-set-selected]', () => {
const response = vectorStyleReducer(defaultVectorStyleState, {
type: SET_SELECTED_VECTORS,
payload: { some_layer_id: ['some_feature_id'] },