create component test for GraphOptionsCustomizeColumns

pull/2996/head
Iris Scholten 2018-03-14 18:17:32 -07:00
parent 5f13493e9b
commit 9d9525e821
1 changed files with 34 additions and 0 deletions

View File

@ -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(<GraphOptionsCustomizeColumns {...props} />)
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)
})
})
})