Change shift shape to array in test
parent
f8373ba720
commit
0f06d29af6
|
@ -482,7 +482,7 @@ describe('Chronograf.Reducers.DataExplorer.queryConfigs', () => {
|
|||
const action = timeShift(queryID, shift)
|
||||
const nextState = reducer(initialState, action)
|
||||
|
||||
expect(nextState[queryID].shift).to.deep.equal(shift)
|
||||
expect(nextState[queryID].shift).to.deep.equal([shift])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -69,14 +69,6 @@ export const shiftTimeRange = (timeRange, shift) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const shiftDate = (date, multiple, unit) => {
|
||||
if (!date && !multiple && !unit) {
|
||||
return moment(date)
|
||||
}
|
||||
|
||||
return moment(date).add(multiple, getMomentUnit(unit))
|
||||
}
|
||||
|
||||
const getMomentUnit = unit => {
|
||||
switch (unit) {
|
||||
case 'ms': {
|
||||
|
@ -108,3 +100,11 @@ const getMomentUnit = unit => {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const shiftDate = (date, multiple, unit) => {
|
||||
if (!date && !multiple && !unit) {
|
||||
return moment(date)
|
||||
}
|
||||
|
||||
return moment(date).add(multiple, getMomentUnit(unit))
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ const defaultQueryConfig = ({id, isKapacitorRule = false}) => {
|
|||
areTagsAccepted: true,
|
||||
rawText: null,
|
||||
status: null,
|
||||
shift: null,
|
||||
shift: [],
|
||||
}
|
||||
|
||||
return isKapacitorRule ? queryConfig : {...queryConfig, fill: NULL_STRING}
|
||||
|
|
|
@ -243,4 +243,4 @@ export const chooseTag = (query, tag) => {
|
|||
return updateTagValues(query.tags[tag.key].concat(tag.value))
|
||||
}
|
||||
|
||||
export const timeShift = (query, shift) => ({...query, shift})
|
||||
export const timeShift = (query, shift) => ({...query, shift: [shift]})
|
||||
|
|
Loading…
Reference in New Issue