Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Jan 7, 2020
1 parent 50245cb commit 6a8f582
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ describe('settings', () => {
code: '1',
label: 'test',
},
aggregatable: true,
},
{
selected: false,
Expand All @@ -123,6 +124,7 @@ describe('settings', () => {
code: '1',
label: 'test',
},
aggregatable: true,
},
])
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,24 @@ describe('fetch_top_nodes', () => {
it('should build terms agg', async () => {
const postMock = jest.fn(() => Promise.resolve({ resp: {} }));
await fetchTopNodes(postMock as any, 'test', [
{ color: '', hopSize: 5, icon, name: 'field1', selected: false, type: 'string' },
{ color: '', hopSize: 5, icon, name: 'field2', selected: false, type: 'string' },
{
color: '',
hopSize: 5,
icon,
name: 'field1',
selected: false,
type: 'string',
aggregatable: true,
},
{
color: '',
hopSize: 5,
icon,
name: 'field2',
selected: false,
type: 'string',
aggregatable: true,
},
]);
expect(postMock).toHaveBeenCalledWith('../api/graph/searchProxy', {
body: JSON.stringify({
Expand Down Expand Up @@ -65,8 +81,24 @@ describe('fetch_top_nodes', () => {
})
);
const result = await fetchTopNodes(postMock as any, 'test', [
{ color: 'red', hopSize: 5, icon, name: 'field1', selected: false, type: 'string' },
{ color: 'blue', hopSize: 5, icon, name: 'field2', selected: false, type: 'string' },
{
color: 'red',
hopSize: 5,
icon,
name: 'field1',
selected: false,
type: 'string',
aggregatable: true,
},
{
color: 'blue',
hopSize: 5,
icon,
name: 'field2',
selected: false,
type: 'string',
aggregatable: true,
},
]);
expect(result.length).toEqual(4);
expect(result[0]).toEqual({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ describe('serialize', () => {
name: 'field1',
selected: true,
type: 'string',
aggregatable: true,
},
{
color: 'black',
icon: { class: 'b', code: '', label: '' },
name: 'field2',
selected: true,
type: 'string',
aggregatable: true,
},
],
selectedIndex: {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/graph/public/types/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface SerializedUrlTemplate extends Omit<UrlTemplate, 'encoder' | 'ic
encoderID: string;
iconClass?: string;
}
export interface SerializedField extends Omit<WorkspaceField, 'icon' | 'type'> {
export interface SerializedField extends Omit<WorkspaceField, 'icon' | 'type' | 'aggregatable'> {
iconClass: string;
}

Expand Down

0 comments on commit 6a8f582

Please sign in to comment.