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

Commit bd39498

Browse files
author
Christine Chambers
committed
Add tests for transformProps
1 parent 4cc5db0 commit bd39498

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { ChartProps } from '@superset-ui/chart';
2+
import transformProps from '../src/transformProps';
3+
4+
describe('WordCloud tranformProps', () => {
5+
const formData = {
6+
colorScheme: 'bnbColors',
7+
datasource: '3__table',
8+
granularity_sqla: 'ds',
9+
metric: 'sum__num',
10+
rotation: 'square',
11+
series: 'name',
12+
sizeFrom: 10,
13+
sizeTo: 70,
14+
};
15+
const chartProps = new ChartProps({
16+
formData,
17+
width: 800,
18+
height: 600,
19+
payload: {
20+
data: [{ name: 'Hulk', sum__num: 1 }],
21+
},
22+
});
23+
24+
it('should tranform chart props for word cloud viz', () => {
25+
expect(transformProps(chartProps)).toEqual({
26+
colorScheme: 'bnbColors',
27+
width: 800,
28+
height: 600,
29+
rotation: 'square',
30+
sizeRange: [10, 70],
31+
data: [{ size: 1, text: 'Hulk' }],
32+
});
33+
});
34+
});

0 commit comments

Comments
 (0)