Test cleanup

pull/2083/head
Andrew Watkins 2017-10-05 18:16:06 -07:00
parent a861c7a862
commit 9abbce4160
1 changed files with 29 additions and 11 deletions

View File

@ -41,9 +41,10 @@ describe('Dashboards.Reducers.DashTimeV1', () => {
expect(actual.ranges).to.deep.equal(expected)
})
it('can update a dashboard time range', () => {
describe('setting a dashboard time range', () => {
it('can update an existing dashboard', () => {
const state = {
ranges: [{dashboardID, timeRange}],
ranges: [{dashboardID, upper: timeRange.upper, lower: timeRange.lower}],
}
const {upper, lower} = {
@ -51,9 +52,26 @@ describe('Dashboards.Reducers.DashTimeV1', () => {
lower: '2017-10-05 12:04',
}
const actual = reducer(state, updateDashTimeV1(dashboardID, {upper, lower}))
const actual = reducer(
state,
updateDashTimeV1(dashboardID, {upper, lower})
)
const expected = [{dashboardID, upper, lower}]
expect(actual.ranges).to.deep.equal(expected)
})
it('can set a new time range if none exists', () => {
const actual = reducer(
emptyState,
updateDashTimeV1(dashboardID, timeRange)
)
const expected = [
{dashboardID, upper: timeRange.upper, lower: timeRange.lower},
]
expect(actual.ranges).to.deep.equal(expected)
})
})
})