blob: 9b2ee5362d1974edd8109c40df0e46a6e7ccf9c5 [file] [log] [blame]
import { ChartProps } from '@superset-ui/core';
import transformProps from '../../src/plugin/transformProps';
describe('<%= packageLabel %> tranformProps', () => {
const formData = {
colorScheme: 'bnbColors',
datasource: '3__table',
granularity_sqla: 'ds',
metric: 'sum__num',
series: 'name',
boldText: true,
headerFontSize: 'xs',
headerText: 'my text',
};
const chartProps = new ChartProps({
formData,
width: 800,
height: 600,
queriesData: [{
data: [{ name: 'Hulk', sum__num: 1<%if (chartType === 'timeseries') { %>, __timestamp: 599616000000<% } %> }],
}],
});
it('should tranform chart props for viz', () => {
expect(transformProps(chartProps)).toEqual({
width: 800,
height: 600,
boldText: true,
headerFontSize: 'xs',
headerText: 'my text',
data: [{ name: 'Hulk', sum__num: 1<%if (chartType === 'timeseries') { %>, __timestamp: new Date(599616000000)<% } %> }],
});
});
});