kibana/x-pack/plugins/features/server/mocks.ts
Larry Gregory 4256c18230
Remove circular dependency between features and security (#100206)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-05-19 11:33:44 -04:00

38 lines
1.1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { PluginSetupContract, PluginStartContract } from './plugin';
import {
featurePrivilegeIterator,
subFeaturePrivilegeIterator,
} from './feature_privilege_iterator';
const createSetup = (): jest.Mocked<PluginSetupContract> => {
return {
getKibanaFeatures: jest.fn(),
getElasticsearchFeatures: jest.fn(),
getFeaturesUICapabilities: jest.fn(),
registerKibanaFeature: jest.fn(),
registerElasticsearchFeature: jest.fn(),
enableReportingUiCapabilities: jest.fn(),
featurePrivilegeIterator: jest.fn().mockImplementation(featurePrivilegeIterator),
subFeaturePrivilegeIterator: jest.fn().mockImplementation(subFeaturePrivilegeIterator),
};
};
const createStart = (): jest.Mocked<PluginStartContract> => {
return {
getKibanaFeatures: jest.fn(),
getElasticsearchFeatures: jest.fn(),
};
};
export const featuresPluginMock = {
createSetup,
createStart,
};