Change shift shape to array in test

pull/10616/head
Andrew Watkins 2017-11-08 15:37:02 -08:00
parent f8373ba720
commit 0f06d29af6
4 changed files with 11 additions and 11 deletions

View File

@ -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])
})
})
})

View File

@ -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))
}

View File

@ -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}

View File

@ -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]})