-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...lugins/discover/public/application/components/discover_grid/discover_grid_flyout.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { findTestSubject } from '@elastic/eui/lib/test'; | ||
import { mountWithIntl } from '@kbn/test/jest'; | ||
import { DiscoverGridFlyout } from './discover_grid_flyout'; | ||
import { esHits } from '../../../__mocks__/es_hits'; | ||
import { createFilterManagerMock } from '../../../../../data/public/query/filter_manager/filter_manager.mock'; | ||
import { indexPatternMock } from '../../../__mocks__/index_pattern'; | ||
import { DiscoverServices } from '../../../build_services'; | ||
import { DocViewsRegistry } from '../../doc_views/doc_views_registry'; | ||
import { setDocViewsRegistry } from '../../../kibana_services'; | ||
|
||
describe('Discover flyout', function () { | ||
it('should be rendered', async () => { | ||
setDocViewsRegistry(new DocViewsRegistry()); | ||
const component = mountWithIntl( | ||
<DiscoverGridFlyout | ||
columns={['date']} | ||
indexPattern={indexPatternMock} | ||
hit={esHits[0]} | ||
onAddColumn={jest.fn()} | ||
onClose={jest.fn()} | ||
onFilter={jest.fn()} | ||
onRemoveColumn={jest.fn()} | ||
services={({ filterManager: createFilterManagerMock() } as unknown) as DiscoverServices} | ||
/> | ||
); | ||
|
||
const url = findTestSubject(component, 'docTableRowAction').prop('href'); | ||
expect(url).toMatchInlineSnapshot(`"#/doc/the-index-pattern-id/i?id=1"`); | ||
}); | ||
}); |