mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
* Add unit test coverage
* Add tests to util/richHistory
* Remove unused import
* Remove redundant tests
* Fix tests for components
* Test saving to local storage
* Add boxshadow to container
* Revert "Add boxshadow to container"
This reverts commit 5ca2e850e4
.
* Fix failing tests after merging master
* Fix imports, aria-labels
* Remove console.log
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import { Resizable } from 're-resizable';
|
|
|
|
import { ExploreId } from '../../../types/explore';
|
|
import { RichHistoryContainer, Props } from './RichHistoryContainer';
|
|
import { Tabs } from './RichHistory';
|
|
|
|
jest.mock('../state/selectors', () => ({ getExploreDatasources: jest.fn() }));
|
|
|
|
const setup = (propOverrides?: Partial<Props>) => {
|
|
const props: Props = {
|
|
width: 500,
|
|
exploreId: ExploreId.left,
|
|
activeDatasourceInstance: 'Test datasource',
|
|
richHistory: [],
|
|
firstTab: Tabs.RichHistory,
|
|
deleteRichHistory: jest.fn(),
|
|
onClose: jest.fn(),
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
const wrapper = mount(<RichHistoryContainer {...props} />);
|
|
return wrapper;
|
|
};
|
|
|
|
describe('RichHistoryContainer', () => {
|
|
it('should render reseizable component', () => {
|
|
const wrapper = setup();
|
|
expect(wrapper.find(Resizable)).toHaveLength(1);
|
|
});
|
|
it('should render component with correct width', () => {
|
|
const wrapper = setup();
|
|
expect(wrapper.getDOMNode().getAttribute('style')).toContain('width: 531.5px');
|
|
});
|
|
it('should render component with correct height', () => {
|
|
const wrapper = setup();
|
|
expect(wrapper.getDOMNode().getAttribute('style')).toContain('height: 400px');
|
|
});
|
|
});
|