mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
39c9c6b0da
* renders ManageQueriesPage at /queries/manage * Renames QueriesList components to ScheduledQueriesList components * creates QueriesList component * Adds side panel component to display query details * Adds KolideAce editor to Query Details side panel * Handle Edit Query button click * Change text of the Delete Query button * Show confirmation modal before deleting queries
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import expect, { createSpy, restoreSpies } from 'expect';
|
|
import { mount } from 'enzyme';
|
|
import { noop } from 'lodash';
|
|
|
|
import QueryDetailsSidePanel from 'components/side_panels/QueryDetailsSidePanel';
|
|
import { queryStub } from 'test/stubs';
|
|
|
|
describe('QueryDetailsSidePanel - component', () => {
|
|
afterEach(restoreSpies);
|
|
|
|
it('renders', () => {
|
|
const component = mount(<QueryDetailsSidePanel onEditQuery={noop} query={queryStub} />);
|
|
|
|
expect(component.length).toEqual(1);
|
|
});
|
|
|
|
it('renders a read-only Kolide Ace component with the query text', () => {
|
|
const component = mount(<QueryDetailsSidePanel onEditQuery={noop} query={queryStub} />);
|
|
const aceEditor = component.find('KolideAce');
|
|
|
|
expect(aceEditor.length).toEqual(1);
|
|
expect(aceEditor.prop('value')).toEqual(queryStub.query);
|
|
expect(aceEditor.prop('readOnly')).toEqual(true);
|
|
});
|
|
|
|
it('calls the onEditQuery prop when Edit/Run Query is clicked', () => {
|
|
const spy = createSpy();
|
|
const component = mount(<QueryDetailsSidePanel onEditQuery={spy} query={queryStub} />);
|
|
const button = component.find('Button');
|
|
|
|
button.simulate('click');
|
|
|
|
expect(spy).toHaveBeenCalledWith(queryStub);
|
|
});
|
|
});
|