From a23fabd77815e81364eb5b86bce14c6655077e8f Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Thu, 9 Jul 2020 18:00:12 -0400 Subject: [PATCH] Fix fill color reducer test --- test/unit/fill-color-reducer.test.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test/unit/fill-color-reducer.test.js b/test/unit/fill-color-reducer.test.js index fb830431..35fa60b0 100644 --- a/test/unit/fill-color-reducer.test.js +++ b/test/unit/fill-color-reducer.test.js @@ -1,8 +1,9 @@ /* eslint-env jest */ -import fillColorReducer from '../../src/reducers/fill-color'; -import {changeFillColor} from '../../src/reducers/fill-color'; +import fillColorReducer from '../../src/reducers/fill-style'; +import {changeFillColor} from '../../src/reducers/fill-style'; import {setSelectedItems} from '../../src/reducers/selected-items'; import {MIXED} from '../../src/helper/style-path'; +import GradientTypes from '../../src/lib/gradient-types'; import {mockPaperRootItem} from '../__mocks__/paperMocks'; test('initialState', () => { @@ -16,16 +17,16 @@ test('changeFillColor', () => { // 3 value hex code let newFillColor = '#fff'; - expect(fillColorReducer(defaultState /* state */, changeFillColor(newFillColor) /* action */)) + expect(fillColorReducer(defaultState /* state */, changeFillColor(newFillColor) /* action */).primary) .toEqual(newFillColor); - expect(fillColorReducer('#010' /* state */, changeFillColor(newFillColor) /* action */)) + expect(fillColorReducer('#010' /* state */, changeFillColor(newFillColor) /* action */).primary) .toEqual(newFillColor); // 6 value hex code newFillColor = '#facade'; - expect(fillColorReducer(defaultState /* state */, changeFillColor(newFillColor) /* action */)) + expect(fillColorReducer(defaultState /* state */, changeFillColor(newFillColor) /* action */).primary) .toEqual(newFillColor); - expect(fillColorReducer('#010' /* state */, changeFillColor(newFillColor) /* action */)) + expect(fillColorReducer('#010' /* state */, changeFillColor(newFillColor) /* action */).primary) .toEqual(newFillColor); }); @@ -35,18 +36,18 @@ test('changefillColorViaSelectedItems', () => { const fillColor1 = 6; const fillColor2 = null; // transparent let selectedItems = [mockPaperRootItem({fillColor: fillColor1})]; - expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */)) + expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */).primary) .toEqual(fillColor1); selectedItems = [mockPaperRootItem({fillColor: fillColor2})]; - expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */)) + expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */).primary) .toEqual(fillColor2); selectedItems = [mockPaperRootItem({fillColor: fillColor1}), mockPaperRootItem({fillColor: fillColor2})]; - expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */)) + expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */).primary) .toEqual(MIXED); }); test('invalidChangeFillColor', () => { - const origState = '#fff'; + const origState = {primary: '#fff', secondary: null, gradientType: GradientTypes.SOLID}; expect(fillColorReducer(origState /* state */, changeFillColor() /* action */)) .toBe(origState);