mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
8bb2a39d86
* Improves re-usability of the SelectTargetsDropdown
24 lines
660 B
JavaScript
24 lines
660 B
JavaScript
import expect from 'expect';
|
|
|
|
import helpers from './helpers';
|
|
|
|
const label1 = { id: 1, target_type: 'labels' };
|
|
const label2 = { id: 2, target_type: 'labels' };
|
|
const host1 = { id: 6, target_type: 'hosts' };
|
|
const host2 = { id: 5, target_type: 'hosts' };
|
|
|
|
describe('SelectTargetsDropdown - helpers', () => {
|
|
describe('#formatSelectedTargetsForApi', () => {
|
|
const { formatSelectedTargetsForApi } = helpers;
|
|
|
|
it('splits targets into labels and hosts', () => {
|
|
const targets = [host1, host2, label1, label2];
|
|
|
|
expect(formatSelectedTargetsForApi(targets)).toEqual({
|
|
hosts: [6, 5],
|
|
labels: [1, 2],
|
|
});
|
|
});
|
|
});
|
|
});
|