fleet/frontend/components/packs/PacksList/PacksList.tests.jsx
Mike Stone 4ba3ad51f0 All packs page (#709)
* Display packs page at /packs/manage

* Adds NumberPill component

* Filter packs list

* Render the pack info side panel when no packs are selected

* Adds packs list

* Moves state management to page component

* Display selected pack count

* Render bulk action buttons

* API client - update pack

* API client - destroy pack

* Adds update/destroy functions to packs redux config

* Bulk actions (enable, disable, delete)

* Selecting a pack updates state

* PackDetailsSidePanel updates pack status

* Link to edit pack on side panel

* sets selected pack in URL

* Sets color for unsettled buttons

* Loads scheduled queries for selected pack in All Packs Page

* PackDetailsSidePanel component

* PackDetailsSidePanel styles

* styles PacksList component

* Stop rendering flash when pack status is updated

* Makes full row clickable

* highlight selected pack
2017-01-03 15:56:50 -05:00

34 lines
1.1 KiB
JavaScript

import React from 'react';
import expect, { createSpy, restoreSpies } from 'expect';
import { mount } from 'enzyme';
import PacksList from 'components/packs/PacksList';
import { packStub } from 'test/stubs';
describe('PacksList - component', () => {
afterEach(restoreSpies);
it('renders', () => {
expect(mount(<PacksList packs={[packStub]} />).length).toEqual(1);
});
it('calls the onCheckAllPacks prop when select all packs checkbox is checked', () => {
const spy = createSpy();
const component = mount(<PacksList onCheckAllPacks={spy} packs={[packStub]} />);
component.find({ name: 'select-all-packs' }).simulate('change');
expect(spy).toHaveBeenCalledWith(true);
});
it('calls the onCheckPack prop when a pack checkbox is checked', () => {
const spy = createSpy();
const component = mount(<PacksList onCheckPack={spy} packs={[packStub]} />);
const packCheckbox = component.find({ name: `select-pack-${packStub.id}` });
packCheckbox.simulate('change');
expect(spy).toHaveBeenCalledWith(true, packStub.id);
});
});