Skip to content

Commit

Permalink
Fix agent status lookup (elastic#25557) (elastic#25842)
Browse files Browse the repository at this point in the history
* Updates service overview to only do agent status check once

* TS support added for EmptyMessage and those who import it

* Fixed up tests

* Finishes TS and test updates for agent check fix

* Fixing up tests

* Fixed linting error

* Updated broken tests

* Re-typed the service list response, camelCase throughout

* Fixes broken test after data change

* Makes initial data type more specific

* Moves service list item TS interface back into server lib file
  • Loading branch information
jasonrhodes authored Nov 17, 2018
1 parent 5cd1f9b commit 845bc12
Show file tree
Hide file tree
Showing 14 changed files with 262 additions and 793 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React from 'react';
import Histogram from '../../../shared/charts/Histogram';
import EmptyMessage from '../../../shared/EmptyMessage';
import { EmptyMessage } from '../../../shared/EmptyMessage';
import { HeaderSmall } from '../../../shared/UIComponents';

export function getFormattedBuckets(buckets, bucketSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,43 @@
*/

import React from 'react';
import { mount } from 'enzyme';

import { MemoryRouter } from 'react-router-dom';
import { ServiceList } from '../index';
import { shallow } from 'enzyme';
import { ServiceList, SERVICE_COLUMNS } from '../index';
import props from './props.json';
import {
mountWithRouterAndStore,
mockMoment,
toJson
} from '../../../../../utils/testHelpers';
import { mockMoment } from '../../../../../utils/testHelpers';

describe('ErrorGroupOverview -> List', () => {
beforeAll(() => {
mockMoment();
});

it('should render empty state', () => {
const storeState = {};
const wrapper = mount(
<MemoryRouter>
<ServiceList items={[]} />
</MemoryRouter>,
storeState
);

expect(toJson(wrapper)).toMatchSnapshot();
const wrapper = shallow(<ServiceList items={[]} />);
expect(wrapper).toMatchSnapshot();
});

it('should render with data', () => {
const storeState = { location: {} };
const wrapper = mountWithRouterAndStore(
<ServiceList items={props.items} />,
storeState
);
const wrapper = shallow(<ServiceList items={props.items} />);
expect(wrapper).toMatchSnapshot();
});

expect(toJson(wrapper)).toMatchSnapshot();
it('should render columns correctly', () => {
const service = {
serviceName: 'opbeans-python',
agentName: 'python',
transactionsPerMinute: 86.93333333333334,
errorsPerMinute: 12.6,
avgResponseTime: 91535.42944785276
};
const renderedColumns = SERVICE_COLUMNS.map(c =>
c.render(service[c.field], service)
);
expect(renderedColumns[0]).toMatchSnapshot();
expect(renderedColumns.slice(1)).toEqual([
'python',
'92 ms',
'86.9 tpm',
'12.6 err.'
]);
});
});
Loading

0 comments on commit 845bc12

Please sign in to comment.