diff --git a/x-pack/plugins/enterprise_search/jest.config.js b/x-pack/plugins/enterprise_search/jest.config.js index be9f7b9939a66..7d10d7aa87bf2 100644 --- a/x-pack/plugins/enterprise_search/jest.config.js +++ b/x-pack/plugins/enterprise_search/jest.config.js @@ -15,5 +15,6 @@ module.exports = { '/x-pack/plugins/enterprise_search/**/*.{ts,tsx}', '!/x-pack/plugins/enterprise_search/public/*.ts', '!/x-pack/plugins/enterprise_search/server/*.ts', + '!/x-pack/plugins/enterprise_search/public/applications/test_helpers/**/*.{ts,tsx}', ], }; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/domains_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/domains_table.test.tsx index aab2909d630ed..fc5ad0cb06411 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/domains_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/domains_table.test.tsx @@ -28,8 +28,17 @@ const domains: CrawlerDomain[] = [ crawlRules: [], entryPoints: [], sitemaps: [], - lastCrawl: '2020-01-01T00:00:00-05:00', - createdOn: '2020-01-01T00:00:00-05:00', + lastCrawl: '2020-01-01T00:00:00-12:00', + createdOn: '2020-01-01T00:00:00-12:00', + }, + { + id: '4567', + documentCount: 0, + url: 'empty.site', + crawlRules: [], + entryPoints: [], + sitemaps: [], + createdOn: '1970-01-01T00:00:00-12:00', }, ]; @@ -68,15 +77,6 @@ describe('DomainsTable', () => { }); describe('columns', () => { - const getTable = () => wrapper.find(EuiInMemoryTable).dive().find(EuiBasicTable).dive(); - - beforeEach(() => { - wrapper = shallow(); - tableContent = mountWithIntl() - .find(EuiInMemoryTable) - .text(); - }); - it('renders a url column', () => { expect(tableContent).toContain('elastic.co'); }); @@ -92,8 +92,9 @@ describe('DomainsTable', () => { }); describe('actions column', () => { + const getTable = () => wrapper.find(EuiInMemoryTable).dive().find(EuiBasicTable).dive(); const getActions = () => getTable().find('ExpandedItemActions'); - const getActionItems = () => getActions().dive().find('DefaultItemAction'); + const getActionItems = () => getActions().first().dive().find('DefaultItemAction'); it('will hide the action buttons if the user cannot manage/delete engines', () => { setMockValues({ diff --git a/x-pack/plugins/enterprise_search/public/applications/index.tsx b/x-pack/plugins/enterprise_search/public/applications/index.tsx index e6acb7f176ee5..67ec06970a77e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/index.tsx @@ -45,10 +45,10 @@ export const renderApp = ( const unmountKibanaLogic = mountKibanaLogic({ config, charts: plugins.charts, - cloud: plugins.cloud || {}, + cloud: plugins.cloud, history: params.history, navigateToUrl: core.application.navigateToUrl, - security: plugins.security || {}, + security: plugins.security, setBreadcrumbs: core.chrome.setBreadcrumbs, setChromeIsVisible: core.chrome.setIsVisible, setDocTitle: core.chrome.docTitle.change, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts index 9c6db7d09f72c..d3b76f8dee9f0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts @@ -20,18 +20,23 @@ import { createHref, CreateHrefOptions } from '../react_router_helpers'; interface KibanaLogicProps { config: { host?: string }; + // Kibana core history: History; - cloud: Partial; - charts: ChartsPluginStart; navigateToUrl: ApplicationStart['navigateToUrl']; - security: Partial; setBreadcrumbs(crumbs: ChromeBreadcrumb[]): void; setChromeIsVisible(isVisible: boolean): void; setDocTitle(title: string): void; renderHeaderActions(HeaderActions: FC): void; + // Required plugins + charts: ChartsPluginStart; + // Optional plugins + cloud?: CloudSetup; + security?: SecurityPluginStart; } -export interface KibanaValues extends KibanaLogicProps { +export interface KibanaValues extends Omit { navigateToUrl(path: string, options?: CreateHrefOptions): Promise; + cloud: Partial; + security: Partial; } export const KibanaLogic = kea>({ diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/types.ts b/x-pack/plugins/enterprise_search/public/applications/shared/types.ts index 5a90dd2c4a6bb..4743e808cc6ea 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/types.ts @@ -38,8 +38,7 @@ export interface RoleMapping { }; } -const productNames = [APP_SEARCH_PLUGIN.NAME, WORKPLACE_SEARCH_PLUGIN.NAME] as const; -export type ProductName = typeof productNames[number]; +export type ProductName = typeof APP_SEARCH_PLUGIN.NAME | typeof WORKPLACE_SEARCH_PLUGIN.NAME; export interface Invitation { email: string;