grafana/public/app/core/components/Select/FolderPicker.test.tsx
Ryan McKinley 8a5fc00330
Live: broadcast events when dashboard is saved (#27583)
Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
2020-10-01 10:46:14 -07:00

31 lines
713 B
TypeScript

import React from 'react';
import { shallow } from 'enzyme';
import { FolderPicker } from './FolderPicker';
jest.mock('@grafana/runtime', () => ({
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => ({
search: jest.fn(() => [
{ title: 'Dash 1', id: 'A' },
{ title: 'Dash 2', id: 'B' },
]),
}),
}));
jest.mock('../../config', () => ({
getConfig: () => ({}),
}));
jest.mock('app/core/services/context_srv', () => ({
contextSrv: {
user: { orgId: 1 },
},
}));
describe('FolderPicker', () => {
it('should render', () => {
const wrapper = shallow(<FolderPicker onChange={jest.fn()} />);
expect(wrapper).toMatchSnapshot();
});
});