mirror of
https://github.com/apache/superset.git
synced 2026-04-17 23:25:05 +00:00
feat: add generic type to column payload (#14547)
* feat: add generic type to column payload * feat: add generic type to column payload * xit flaky test
This commit is contained in:
@@ -20,10 +20,11 @@ import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { ColumnTypeLabel } from '@superset-ui/chart-controls';
|
||||
import { GenericDataType } from '@superset-ui/core';
|
||||
|
||||
describe('ColumnOption', () => {
|
||||
const defaultProps = {
|
||||
type: 'string',
|
||||
type: GenericDataType.STRING,
|
||||
};
|
||||
|
||||
const props = { ...defaultProps };
|
||||
@@ -44,12 +45,16 @@ describe('ColumnOption', () => {
|
||||
expect(lbl.first().text()).toBe('ABC');
|
||||
});
|
||||
it('int type shows # icon', () => {
|
||||
const lbl = getWrapper({ type: 'int(164)' }).find('.type-label');
|
||||
const lbl = getWrapper({
|
||||
type: GenericDataType.NUMERIC,
|
||||
}).find('.type-label');
|
||||
expect(lbl).toHaveLength(1);
|
||||
expect(lbl.first().text()).toBe('#');
|
||||
});
|
||||
it('bool type shows T/F icon', () => {
|
||||
const lbl = getWrapper({ type: 'BOOL' }).find('.type-label');
|
||||
const lbl = getWrapper({
|
||||
type: GenericDataType.BOOLEAN,
|
||||
}).find('.type-label');
|
||||
expect(lbl).toHaveLength(1);
|
||||
expect(lbl.first().text()).toBe('T/F');
|
||||
});
|
||||
@@ -64,7 +69,9 @@ describe('ColumnOption', () => {
|
||||
expect(lbl.first().text()).toBe('?');
|
||||
});
|
||||
it('datetime type displays', () => {
|
||||
const lbl = getWrapper({ type: 'datetime' }).find('.fa-clock-o');
|
||||
const lbl = getWrapper({
|
||||
type: GenericDataType.TEMPORAL,
|
||||
}).find('.fa-clock-o');
|
||||
expect(lbl).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { ColumnMeta } from '@superset-ui/chart-controls';
|
||||
import { ColumnType } from '@superset-ui/core';
|
||||
import { GenericDataType } from '@superset-ui/core';
|
||||
|
||||
export const columns: ColumnMeta[] = [
|
||||
{
|
||||
@@ -29,7 +29,8 @@ export const columns: ColumnMeta[] = [
|
||||
id: 516,
|
||||
is_dttm: false,
|
||||
python_date_format: null,
|
||||
type: ColumnType.DOUBLE,
|
||||
type: 'DOUBLE',
|
||||
type_generic: GenericDataType.NUMERIC,
|
||||
verbose_name: null,
|
||||
},
|
||||
{
|
||||
@@ -42,7 +43,8 @@ export const columns: ColumnMeta[] = [
|
||||
id: 477,
|
||||
is_dttm: false,
|
||||
python_date_format: null,
|
||||
type: ColumnType.STRING,
|
||||
type: 'VARCHAR',
|
||||
type_generic: GenericDataType.STRING,
|
||||
verbose_name: null,
|
||||
},
|
||||
{
|
||||
@@ -54,7 +56,8 @@ export const columns: ColumnMeta[] = [
|
||||
id: 516,
|
||||
is_dttm: false,
|
||||
python_date_format: null,
|
||||
type: ColumnType.DOUBLE,
|
||||
type: 'INT',
|
||||
type_generic: GenericDataType.NUMERIC,
|
||||
verbose_name: null,
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user