This repository was archived by the owner on Dec 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
packages/superset-ui-plugin-chart-word-cloud/test/transformProps.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }], | ||
}); | ||
}); | ||
}); |