Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enterprise Search] Test coverage pass #103406

Merged
merged 5 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/plugins/enterprise_search/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ module.exports = {
'<rootDir>/x-pack/plugins/enterprise_search/**/*.{ts,tsx}',
'!<rootDir>/x-pack/plugins/enterprise_search/public/*.ts',
'!<rootDir>/x-pack/plugins/enterprise_search/server/*.ts',
'!<rootDir>/x-pack/plugins/enterprise_search/public/applications/test_helpers/**/*.{ts,tsx}',
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
];

Expand Down Expand Up @@ -68,15 +77,6 @@ describe('DomainsTable', () => {
});

describe('columns', () => {
const getTable = () => wrapper.find(EuiInMemoryTable).dive().find(EuiBasicTable).dive();

beforeEach(() => {
wrapper = shallow(<DomainsTable />);
tableContent = mountWithIntl(<DomainsTable />)
.find(EuiInMemoryTable)
.text();
});

it('renders a url column', () => {
expect(tableContent).toContain('elastic.co');
});
Expand All @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ import { createHref, CreateHrefOptions } from '../react_router_helpers';

interface KibanaLogicProps {
config: { host?: string };
// Kibana core
history: History;
cloud: Partial<CloudSetup>;
charts: ChartsPluginStart;
navigateToUrl: ApplicationStart['navigateToUrl'];
security: Partial<SecurityPluginStart>;
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<KibanaLogicProps, 'cloud' | 'security'> {
navigateToUrl(path: string, options?: CreateHrefOptions): Promise<void>;
cloud: Partial<CloudSetup>;
security: Partial<SecurityPluginStart>;
}

export const KibanaLogic = kea<MakeLogicType<KibanaValues>>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down