[explore] fix missing CacheLabel (#4326)

Also adding a basic unit test.
This commit is contained in:
Maxime Beauchemin
2018-02-02 10:28:38 -08:00
committed by Grace Guo
parent 75a2b4f610
commit 1f8fccc0f9
2 changed files with 48 additions and 13 deletions

View File

@@ -0,0 +1,40 @@
import React from 'react';
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { shallow } from 'enzyme';
import ExploreChartHeader from '../../../../javascripts/explore/components/ExploreChartHeader';
import ExploreActionButtons from '../../../../javascripts/explore/components/ExploreActionButtons';
import EditableTitle from '../../../../javascripts/components/EditableTitle';
const mockProps = {
actions: {},
can_overwrite: true,
can_download: true,
isStarred: true,
slice: {},
table_name: 'foo',
form_data: {},
timeout: 1000,
chart: {
queryResponse: {},
},
};
describe('ExploreChartHeader', () => {
let wrapper;
beforeEach(() => {
wrapper = shallow(<ExploreChartHeader {...mockProps} />);
});
it('is valid', () => {
expect(
React.isValidElement(<ExploreChartHeader {...mockProps} />),
).to.equal(true);
});
it('renders', () => {
expect(wrapper.find(EditableTitle)).to.have.lengthOf(1);
expect(wrapper.find(ExploreActionButtons)).to.have.lengthOf(1);
});
});