From 9d9525e8217fc088d03d2c271073d2db3c6199e4 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Wed, 14 Mar 2018 18:17:32 -0700 Subject: [PATCH] create component test for GraphOptionsCustomizeColumns --- .../GraphOptionsCustomizeColumns.test.tsx | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx diff --git a/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx new file mode 100644 index 000000000..a21e6140d --- /dev/null +++ b/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx @@ -0,0 +1,34 @@ +import React from 'react' + +import GraphOptionsCustomizeColumns from 'src/dashboards/components/GraphOptionsCustomizeColumns' +import GraphOptionsCustomizableColumn from 'src/dashboards/components/GraphOptionsCustomizableColumn' +import {TIME_COLUMN_DEFAULT} from 'src/shared/constants/tableGraph' + +import {shallow} from 'enzyme' + +const setup = (override = {}) => { + const props = { + columns: [], + onColumnRename: () => {}, + ...override, + } + + const wrapper = shallow() + + return {wrapper, props} +} + +describe('Dashboards.Components.GraphOptionsCustomizeColumns', () => { + describe('rendering', () => { + it('displays label and all columns passed in', () => { + const columns = [TIME_COLUMN_DEFAULT] + const {wrapper} = setup(columns) + const label = wrapper.find('label') + const customizableColumns = wrapper.find(GraphOptionsCustomizableColumn) + + expect(label.exists()).toBe(true) + expect(customizableColumns.exists()).toBe(true) + expect(customizableColumns.length).toBe(columns.length) + }) + }) +})