Skip to content

Commit

Permalink
Fix types for terms.test
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaDerevyankina committed Aug 25, 2021
1 parent 8e5a016 commit 4dd300f
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { createMockedIndexPattern } from '../../../mocks';
import { ValuesInput } from './values_input';
import type { TermsIndexPatternColumn } from '.';
import { termsOperation } from '../index';
import { IndexPattern, IndexPatternLayer } from '../../../types';
import type { IndexPattern, IndexPatternField, IndexPatternLayer } from '../../../types';
import { FrameDatasourceAPI } from '../../../../types';

const uiSettingsMock = {} as IUiSettingsClient;
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('terms', () => {
describe('getPossibleOperationForField', () => {
it('should return operation with the right type', () => {
expect(
termsOperation.getPossibleOperationForField({
termsOperation.getPossibleOperationForField(({
aggregatable: true,
searchable: true,
name: 'test',
Expand All @@ -188,15 +188,15 @@ describe('terms', () => {
agg: 'terms',
},
},
})
} as unknown) as IndexPatternField)
).toEqual({
dataType: 'string',
isBucketed: true,
scale: 'ordinal',
});

expect(
termsOperation.getPossibleOperationForField({
termsOperation.getPossibleOperationForField(({
aggregatable: true,
searchable: true,
name: 'test',
Expand All @@ -207,7 +207,7 @@ describe('terms', () => {
agg: 'terms',
},
},
})
} as unknown) as IndexPatternField)
).toEqual({
dataType: 'number',
isBucketed: true,
Expand All @@ -221,7 +221,7 @@ describe('terms', () => {
name: 'test',
displayName: 'test',
type: 'boolean',
})
} as IndexPatternField)
).toEqual({
dataType: 'boolean',
isBucketed: true,
Expand All @@ -235,7 +235,7 @@ describe('terms', () => {
name: 'test',
displayName: 'test',
type: 'ip',
})
} as IndexPatternField)
).toEqual({
dataType: 'ip',
isBucketed: true,
Expand All @@ -251,7 +251,7 @@ describe('terms', () => {
name: 'test',
displayName: 'test',
type: 'string',
})
} as IndexPatternField)
).toEqual(undefined);

expect(
Expand All @@ -262,7 +262,7 @@ describe('terms', () => {
name: 'test',
displayName: 'test',
type: 'string',
})
} as IndexPatternField)
).toEqual(undefined);
});
});
Expand All @@ -277,7 +277,7 @@ describe('terms', () => {
type: 'boolean',
name: 'test',
displayName: 'test',
},
} as IndexPatternField,
layer: { columns: {}, columnOrder: [], indexPatternId: '' },
});
expect(termsColumn.dataType).toEqual('boolean');
Expand All @@ -292,7 +292,7 @@ describe('terms', () => {
type: 'boolean',
name: 'test',
displayName: 'test',
},
} as IndexPatternField,
layer: { columns: {}, columnOrder: [], indexPatternId: '' },
});
expect(termsColumn.params.otherBucket).toEqual(true);
Expand All @@ -307,7 +307,7 @@ describe('terms', () => {
type: 'boolean',
name: 'test',
displayName: 'test',
},
} as IndexPatternField,
layer: { columns: {}, columnOrder: [], indexPatternId: '' },
});
expect(termsColumn.params.otherBucket).toEqual(false);
Expand Down Expand Up @@ -335,7 +335,7 @@ describe('terms', () => {
type: 'boolean',
name: 'test',
displayName: 'test',
},
} as IndexPatternField,
});
expect(termsColumn.params).toEqual(
expect.objectContaining({
Expand Down Expand Up @@ -368,7 +368,7 @@ describe('terms', () => {
type: 'boolean',
name: 'test',
displayName: 'test',
},
} as IndexPatternField,
});
expect(termsColumn.params).toEqual(
expect.objectContaining({ orderBy: { type: 'alphabetical', fallback: true } })
Expand All @@ -385,7 +385,7 @@ describe('terms', () => {
type: 'boolean',
name: 'test',
displayName: 'test',
},
} as IndexPatternField,
});
expect(termsColumn.params).toEqual(expect.objectContaining({ size: 3 }));
});
Expand All @@ -400,7 +400,7 @@ describe('terms', () => {
type: 'boolean',
name: 'test',
displayName: 'test',
},
} as IndexPatternField,
});
expect(termsColumn.params).toEqual(expect.objectContaining({ size: 5 }));
});
Expand Down

0 comments on commit 4dd300f

Please sign in to comment.