Skip to content
This repository was archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
Add tests for transformProps
Browse files Browse the repository at this point in the history
  • Loading branch information
xtinec committed Jan 4, 2019
1 parent 4cc5db0 commit bd39498
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ChartProps } from '@superset-ui/chart';
import transformProps from '../src/transformProps';

describe('WordCloud tranformProps', () => {
const formData = {
colorScheme: 'bnbColors',
datasource: '3__table',
granularity_sqla: 'ds',
metric: 'sum__num',
rotation: 'square',
series: 'name',
sizeFrom: 10,
sizeTo: 70,
};
const chartProps = new ChartProps({
formData,
width: 800,
height: 600,
payload: {
data: [{ name: 'Hulk', sum__num: 1 }],
},
});

it('should tranform chart props for word cloud viz', () => {
expect(transformProps(chartProps)).toEqual({
colorScheme: 'bnbColors',
width: 800,
height: 600,
rotation: 'square',
sizeRange: [10, 70],
data: [{ size: 1, text: 'Hulk' }],
});
});
});

0 comments on commit bd39498

Please sign in to comment.