Skip to content

Commit 41db653

Browse files
committed
initialising saved search in beforeEach
1 parent 280562d commit 41db653

File tree

1 file changed

+40
-37
lines changed

1 file changed

+40
-37
lines changed

x-pack/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.test.ts

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,51 @@ import { SavedSearchSavedObject } from '../../../../../common/types/kibana';
1010
import { createSearchItems } from './new_job_utils';
1111

1212
describe('createSearchItems', () => {
13-
const savedSearch = ({
14-
client: {
15-
http: {
16-
basePath: {
17-
basePath: '/abc',
18-
serverBasePath: '/abc',
19-
},
20-
anonymousPaths: {},
21-
},
22-
batchQueue: [],
23-
},
24-
attributes: {
25-
title: 'not test',
26-
description: '',
27-
hits: 0,
28-
columns: ['_source'],
29-
sort: [],
30-
version: 1,
31-
kibanaSavedObjectMeta: {
32-
searchSourceJSON: '',
33-
},
34-
},
35-
_version: 'WzI0OSw0XQ==',
36-
id: '4b9b1010-c678-11ea-b6e6-e942978fa29c',
37-
type: 'search',
38-
migrationVersion: {
39-
search: '7.4.0',
40-
},
41-
references: [
42-
{
43-
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
44-
type: 'index-pattern',
45-
id: '7e252840-bd27-11ea-8a6c-75d1a0bd08ab',
46-
},
47-
],
48-
} as unknown) as SavedSearchSavedObject;
49-
5013
const kibanaConfig = {} as IUiSettingsClient;
5114
const indexPattern = ({
5215
fields: [],
5316
} as unknown) as IIndexPattern;
5417

18+
let savedSearch = ({} as unknown) as SavedSearchSavedObject;
19+
beforeEach(() => {
20+
savedSearch = ({
21+
client: {
22+
http: {
23+
basePath: {
24+
basePath: '/abc',
25+
serverBasePath: '/abc',
26+
},
27+
anonymousPaths: {},
28+
},
29+
batchQueue: [],
30+
},
31+
attributes: {
32+
title: 'not test',
33+
description: '',
34+
hits: 0,
35+
columns: ['_source'],
36+
sort: [],
37+
version: 1,
38+
kibanaSavedObjectMeta: {
39+
searchSourceJSON: '',
40+
},
41+
},
42+
_version: 'WzI0OSw0XQ==',
43+
id: '4b9b1010-c678-11ea-b6e6-e942978fa29c',
44+
type: 'search',
45+
migrationVersion: {
46+
search: '7.4.0',
47+
},
48+
references: [
49+
{
50+
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
51+
type: 'index-pattern',
52+
id: '7e252840-bd27-11ea-8a6c-75d1a0bd08ab',
53+
},
54+
],
55+
} as unknown) as SavedSearchSavedObject;
56+
});
57+
5558
test('should match index pattern', () => {
5659
const resp = createSearchItems(kibanaConfig, indexPattern, null);
5760
expect(resp).toStrictEqual({

0 commit comments

Comments
 (0)