-
Notifications
You must be signed in to change notification settings - Fork 87
test: add test case of getChartSpecWithContext when chartType is circlePacking #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
test: add test case of getChartSpecWithContext when chartType is circlePacking #257
Conversation
|
||
const generateRandomValue = (min = 100, max = 2000) => Math.floor(Math.random() * (max - min + 1)) + min; | ||
|
||
function generateDataStructure() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
生成层次数据的方法,可以考虑提取成公共的测试方法,方便其他层次数据相关图表,用于生成数据
//console.log("multi-root spec", JSON.stringify(spec, null, 2)); | ||
expect(chartType).toBe(ChartType.BubbleCirclePacking); | ||
expect(spec.type).toBe('circlePacking'); | ||
expect(spec.data.values).toEqual(multi_root_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这三个测试case 是为了覆盖什么内容呢,有没有跑过case1, case 2, case 3 分别能增加多少测试覆盖率呢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新修改了一版test case(getChartSpecWithContext_circlePacking.test.ts)
完成了一下几个方面的测试,基本所有覆盖函数代码
功能项 | 覆盖情况 |
---|---|
vennData 生成:测试3种不同的dataTable | ✅ |
revisedVChartType:检测spec.type | ✅ |
theme 处理 string/object两种情况 | ✅ |
colors 与 chartTheme.colorScheme 的互斥逻辑 | ✅ |
formatSimpleSpec 分支(type, title, dataZoom, label, indicator, palette, background) | ✅ |
bubbleCirclePackingData | ✅ |
bubbleCirclePackingField | ✅ |
bubbleCirclePackingDisplayConf | ✅ |
边界处理(空dataTable、缺失colors、空cell) | ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
测试覆盖率之后可以直接在packages/vmind下跑命令获取哈: npm run test-cov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cb1d3fd
to
afa41f0
Compare
…lePacking (comprehensive version)
…lePacking (add specific test for functions in circlePacking.ts)
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
#238
🔗 Related PR link
🐞 Bugserver case id
💡 Background and solution
Background
This PR addresses the need to validate the correctness of
getChartSpecWithContext()
for circle packing charts, ensuring the method produces valid specifications for this chart type.Solution
spec
including:📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough