Skip to content

Commit

Permalink
reuse abstract field
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed May 14, 2020
1 parent 09a05d9 commit c055cf4
Showing 1 changed file with 11 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,21 @@ import {
RangeFieldMeta,
StyleMetaDescriptor,
} from '../../../../../../common/descriptor_types';
import { IField } from '../../../../fields/field';
import { AbstractVectorSource, IVectorSource } from '../../../../sources/vector_source';
import { ITooltipProperty, TooltipProperty } from '../../../../tooltips/tooltip_property';
import { AbstractField, IField } from '../../../../fields/field';

export const mockField: IField = {
canValueBeFormatted(): boolean {
return true;
},
async createTooltipProperty(value: string | undefined): Promise<ITooltipProperty> {
return new TooltipProperty('foobar', 'foobar', 'foo bar value');
},
async getCategoricalFieldMetaRequest(size: number): Promise<unknown> {
return undefined;
},
async getDataType(): Promise<string> {
return 'string';
},
async getOrdinalFieldMetaRequest(): Promise<unknown> {
return null;
},
getSource(): IVectorSource {
return new AbstractVectorSource({ type: 'TEST' });
},
isValid(): boolean {
return false;
},
class MockField extends AbstractField {
async getLabel(): Promise<string> {
return 'foobar_label';
},
getName(): string {
return 'foobar';
},
getRootName(): string {
return 'foobar';
},
getOrigin(): FIELD_ORIGIN {
return FIELD_ORIGIN.SOURCE;
},
return this.getName() + '_label';
}
supportsFieldMeta(): boolean {
return true;
},
};
}
}

export const mockField: IField = new MockField({
fieldName: 'foobar',
origin: FIELD_ORIGIN.SOURCE,
});

class MockStyle {
getStyleMeta(): StyleMeta {
Expand Down

0 comments on commit c055cf4

Please sign in to comment.