mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
f099b2ae22
* Creates new PackComposerPage at /packs/new * Creates PackForm component * Adds PackForm to PackComposerPage * Creates QueriesListItem * Creates QueriesList * Creates QueriesListWrapper * Get all queries when the Packs Composer Page loads * Form HOC handles updates to formData prop * Creates form to configure scheduled queries * QueriesListWrapper renders ConfigurePackQueryForm * search queries input filters queries list * Empty state text * create pack when user submits the new pack form * Adds Edit pack page to /packs/:pack_id/edit * API client - get scheduled queries for a pack * API client - create scheduled query * Redux config for scheduled queries * Remove scheduled queries from packs * Add labels to pack on create * Add disabled state to the select targets dropdown * Adds edit route and pushes to new route on edit click * Adds cancel button to edit pack form * Adds Checkbox that selects all scheduled queries in table
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import expect, { createSpy, restoreSpies } from 'expect';
|
|
import { mount } from 'enzyme';
|
|
import { noop } from 'lodash';
|
|
|
|
import EditPackFormWrapper from 'components/packs/EditPackFormWrapper';
|
|
import { packStub } from 'test/stubs';
|
|
|
|
describe('EditPackFormWrapper - component', () => {
|
|
afterEach(restoreSpies);
|
|
|
|
it('does not render the EditPackForm by default', () => {
|
|
const component = mount(
|
|
<EditPackFormWrapper
|
|
isEdit={false}
|
|
onCancelEditPack={noop}
|
|
onEditPack={noop}
|
|
pack={packStub}
|
|
/>
|
|
);
|
|
|
|
expect(component.find('EditPackForm').length).toEqual(0);
|
|
});
|
|
|
|
it('renders the EditPackForm when isEdit is true', () => {
|
|
const component = mount(
|
|
<EditPackFormWrapper
|
|
isEdit
|
|
onCancelEditPack={noop}
|
|
onEditPack={noop}
|
|
pack={packStub}
|
|
/>
|
|
);
|
|
|
|
expect(component.find('EditPackForm').length).toEqual(1);
|
|
});
|
|
|
|
it('calls onEditPack when EDIT is clicked', () => {
|
|
const spy = createSpy();
|
|
const component = mount(
|
|
<EditPackFormWrapper
|
|
onCancelEditPack={noop}
|
|
onEditPack={spy}
|
|
pack={packStub}
|
|
/>
|
|
);
|
|
const editBtn = component.find('Button').findWhere(b => b.prop('text') === 'EDIT');
|
|
|
|
editBtn.simulate('click');
|
|
|
|
expect(spy).toHaveBeenCalled();
|
|
});
|
|
});
|