mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
This commit is contained in:
parent
7a63599755
commit
54d46696eb
2 changed files with 14 additions and 19 deletions
|
@ -17,22 +17,19 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import fixturesLogstashFieldsProvider from './logstash_fields';
|
||||
import stubbedLogstashFields from './logstash_fields';
|
||||
import { SimpleSavedObject } from '../legacy/ui/public/saved_objects/simple_saved_object';
|
||||
|
||||
const mockLogstashFields = stubbedLogstashFields();
|
||||
|
||||
export function fixturesStubbedSavedObjectIndexPatternProvider() {
|
||||
const mockLogstashFields = fixturesLogstashFieldsProvider();
|
||||
|
||||
return function (id) {
|
||||
return new SimpleSavedObject(undefined, {
|
||||
id,
|
||||
type: 'index-pattern',
|
||||
attributes: {
|
||||
customFormats: '{}',
|
||||
fields: mockLogstashFields
|
||||
},
|
||||
version: 2
|
||||
});
|
||||
};
|
||||
export function stubbedSavedObjectIndexPattern(id) {
|
||||
return new SimpleSavedObject(undefined, {
|
||||
id,
|
||||
type: 'index-pattern',
|
||||
attributes: {
|
||||
customFormats: '{}',
|
||||
fields: mockLogstashFields
|
||||
},
|
||||
version: 2
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import _ from 'lodash';
|
|||
import { IndexedArray } from '../../indexed_array';
|
||||
import { IndexPattern } from '../_index_pattern';
|
||||
import mockLogstashFields from '../../../../../fixtures/logstash_fields';
|
||||
import { fixturesStubbedSavedObjectIndexPatternProvider } from '../../../../../fixtures/stubbed_saved_object_index_pattern';
|
||||
import { stubbedSavedObjectIndexPattern } from '../../../../../fixtures/stubbed_saved_object_index_pattern';
|
||||
|
||||
jest.mock('../../errors', () => ({
|
||||
SavedObjectNotFound: jest.fn(),
|
||||
|
@ -120,8 +120,6 @@ const config = {
|
|||
get: jest.fn(),
|
||||
};
|
||||
|
||||
const savedObjectsResponse = fixturesStubbedSavedObjectIndexPatternProvider();
|
||||
|
||||
// helper function to create index patterns
|
||||
function create(id, payload) {
|
||||
const indexPattern = new IndexPattern(id, config, savedObjectsClient, patternCache, fieldsFetcher, getIds);
|
||||
|
@ -132,7 +130,7 @@ function create(id, payload) {
|
|||
}
|
||||
|
||||
function setDocsourcePayload(id, providedPayload) {
|
||||
object = _.defaults(providedPayload || {}, savedObjectsResponse(id));
|
||||
object = _.defaults(providedPayload || {}, stubbedSavedObjectIndexPattern(id));
|
||||
}
|
||||
|
||||
describe('IndexPattern', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue