From 6edb4f30e461fcfe0438dd765a8654f1d5664eb4 Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 26 Mar 2018 19:14:06 -0700 Subject: [PATCH] Write reducer test for updating line graph colors --- ui/test/dashboards/reducers/cellEditorOverlay.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/test/dashboards/reducers/cellEditorOverlay.test.js b/ui/test/dashboards/reducers/cellEditorOverlay.test.js index 2d29ecf67b..eb11c734e0 100644 --- a/ui/test/dashboards/reducers/cellEditorOverlay.test.js +++ b/ui/test/dashboards/reducers/cellEditorOverlay.test.js @@ -8,6 +8,7 @@ import { updateThresholdsListColors, updateThresholdsListType, updateGaugeColors, + updateLineColors, updateAxes, } from 'src/dashboards/actions/cellEditorOverlay' import {DEFAULT_TABLE_OPTIONS} from 'src/shared/constants/tableGraph' @@ -17,6 +18,7 @@ import { validateThresholdsListColors, getThresholdsListType, } from 'shared/constants/thresholds' +import {validateLineColors} from 'src/shared/constants/graphColorPalettes' const defaultCellType = 'line' const defaultCellName = 'defaultCell' @@ -45,6 +47,7 @@ const defaultThresholdsListColors = validateThresholdsListColors( defaultThresholdsListType ) const defaultGaugeColors = validateGaugeColors(defaultCell.colors) +const defaultLineColors = validateLineColors(defaultCell.colors) describe('Dashboards.Reducers.cellEditorOverlay', () => { it('should show cell editor overlay', () => { @@ -117,4 +120,11 @@ describe('Dashboards.Reducers.cellEditorOverlay', () => { expect(actual.cell.axes).toBe(expected) }) + + it('should update the cell line graph colors', () => { + const actual = reducer(initialState, updateLineColors(defaultLineColors)) + const expected = defaultLineColors + + expect(actual.lineColors).toBe(expected) + }) })