|
@@ -20,6 +20,7 @@ import {
|
|
|
scanStopAction,
|
|
scanStopAction,
|
|
|
toggleGraphAction,
|
|
toggleGraphAction,
|
|
|
toggleTableAction,
|
|
toggleTableAction,
|
|
|
|
|
+ changeRangeAction,
|
|
|
} from './actionTypes';
|
|
} from './actionTypes';
|
|
|
import { Reducer } from 'redux';
|
|
import { Reducer } from 'redux';
|
|
|
import { ActionOf } from 'app/core/redux/actionCreatorFactory';
|
|
import { ActionOf } from 'app/core/redux/actionCreatorFactory';
|
|
@@ -27,7 +28,7 @@ import { updateLocation } from 'app/core/actions/location';
|
|
|
import { serializeStateToUrlParam } from 'app/core/utils/explore';
|
|
import { serializeStateToUrlParam } from 'app/core/utils/explore';
|
|
|
import TableModel from 'app/core/table_model';
|
|
import TableModel from 'app/core/table_model';
|
|
|
import { DataSourceApi, DataQuery } from '@grafana/ui';
|
|
import { DataSourceApi, DataQuery } from '@grafana/ui';
|
|
|
-import { LogsModel, LogsDedupStrategy } from '@grafana/data';
|
|
|
|
|
|
|
+import { LogsModel, LogsDedupStrategy, dateTime } from '@grafana/data';
|
|
|
|
|
|
|
|
describe('Explore item reducer', () => {
|
|
describe('Explore item reducer', () => {
|
|
|
describe('scanning', () => {
|
|
describe('scanning', () => {
|
|
@@ -196,6 +197,31 @@ describe('Explore item reducer', () => {
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ describe('changing range', () => {
|
|
|
|
|
+ describe('when changeRangeAction is dispatched', () => {
|
|
|
|
|
+ it('then it should set correct state', () => {
|
|
|
|
|
+ reducerTester()
|
|
|
|
|
+ .givenReducer(itemReducer, {
|
|
|
|
|
+ update: { ...makeInitialUpdateState(), range: true },
|
|
|
|
|
+ range: null,
|
|
|
|
|
+ absoluteRange: null,
|
|
|
|
|
+ })
|
|
|
|
|
+ .whenActionIsDispatched(
|
|
|
|
|
+ changeRangeAction({
|
|
|
|
|
+ exploreId: ExploreId.left,
|
|
|
|
|
+ absoluteRange: { from: 1546297200000, to: 1546383600000 },
|
|
|
|
|
+ range: { from: dateTime('2019-01-01'), to: dateTime('2019-01-02'), raw: { from: 'now-1d', to: 'now' } },
|
|
|
|
|
+ })
|
|
|
|
|
+ )
|
|
|
|
|
+ .thenStateShouldEqual({
|
|
|
|
|
+ update: { ...makeInitialUpdateState(), range: false },
|
|
|
|
|
+ absoluteRange: { from: 1546297200000, to: 1546383600000 },
|
|
|
|
|
+ range: { from: dateTime('2019-01-01'), to: dateTime('2019-01-02'), raw: { from: 'now-1d', to: 'now' } },
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
export const setup = (urlStateOverrides?: any) => {
|
|
export const setup = (urlStateOverrides?: any) => {
|