Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Oct 20, 2020
1 parent 3f5d586 commit 4b9bf74
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
ViewMode,
isErrorEmbeddable,
} from '../../../../../../../../src/plugins/embeddable/public';
import { useLayerList } from './LayerList';
import { useLayerList } from './useLayerList';
import { useUrlParams } from '../../../../hooks/useUrlParams';
import { RenderTooltipContentParams } from '../../../../../../maps/public';
import { MapToolTip } from './MapToolTip';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export const mockLayerList = [
id: '3657625d-17b0-41ef-99ba-3a2b2938655c',
indexPatternTitle: 'apm-*',
term: 'client.geo.country_iso_code',
whereQuery: {
language: 'kuery',
query:
'transaction.type : "page-load" and service.name : "undefined"',
},
metrics: [
{
type: 'avg',
Expand Down Expand Up @@ -95,6 +100,11 @@ export const mockLayerList = [
id: 'e62a1b9c-d7ff-4fd4-a0f6-0fdc44bb9e41',
indexPatternTitle: 'apm-*',
term: 'client.geo.region_iso_code',
whereQuery: {
language: 'kuery',
query:
'transaction.type : "page-load" and service.name : "undefined"',
},
metrics: [{ type: 'avg', field: 'transaction.duration.us' }],
indexPatternId: 'apm_static_index_pattern_id',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { renderHook } from '@testing-library/react-hooks';
import { mockLayerList } from './__mocks__/regions_layer.mock';
import { useLayerList } from '../LayerList';
import { useLayerList } from '../useLayerList';

describe('LayerList', () => {
describe('getLayerList', () => {
test('it returns the region layer', () => {
const layerList = useLayerList();
expect(layerList).toStrictEqual(mockLayerList);
});
describe('useLayerList', () => {
test('it returns the region layer', () => {
const { result } = renderHook(() => useLayerList());
expect(result.current).toStrictEqual(mockLayerList);
});
});

0 comments on commit 4b9bf74

Please sign in to comment.