-
Notifications
You must be signed in to change notification settings - Fork 533
test(AutoLink): 完善测试案例 #1558
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
test(AutoLink): 完善测试案例 #1558
Conversation
|
commit: |
【预览链接】
|
|
Size Change: +769 B (+0.01%) Total Size: 6.59 MB
ℹ️ View Unchanged
|
- 提取 createAutoLinkHook 辅助函数,减少重复代码 - 使用 describe 分组测试,提高可读性 - 使用数组解构简化测试用例代码 - 修复 isLinkInATag 正则表达式,正确处理带多个属性的 a 标签 - 修复测试用例中带额外属性的 URL 的 index 和 length 参数 - 合并重复的测试场景,从 25 个测试优化到 15 个 - 代码覆盖率保持在 86.77%
|
📦 cherry-markdown dev preview published
Install NPM with : pnpm add cherry-markdown@npm:@cherry-markdown/[email protected]yarn add cherry-markdown@npm:@cherry-markdown/[email protected]npm i cherry-markdown@npm:@cherry-markdown/[email protected]如果你使用了其他以 cherry-markdown 作为同等依赖(peer dependency)的元框架,你需要在 package.json 文件中覆盖 cherry-markdown 依赖,具体操作方式会因你使用的包管理器而略有不同 If you use a meta framework that has cherry-markdown as peer dependency, you have to override the cherry-markdown dependency in your package.json, which works slightly different depending on your package manager # npm
{
"overrides": {
"cherry-markdown": "npm:@cherry-markdown/[email protected]"
}
}
# yarn
{
"resolutions": {
"cherry-markdown": "npm:@cherry-markdown/[email protected]"
}
}
# pnpm
{
"pnpm": {
"overrides": {
"cherry-markdown": "npm:@cherry-markdown/[email protected]"
}
}
}在添加 overrides 之后,重新安装你的依赖并像往常一样启动你的开发服务器或构建你的项目即可,无需进一步的配置更改 After adding these overrides, reinstall your dependencies and start your development server or build your project as usual. No further configuration changes are required |
|
💻 客户端预览构建已完成 (Client Preview Build Completed) 可下载的安装包macOS (Apple Silicon/arm64)
macOS (Intel/x86_64)
Windows
Linux
|
🔧 主要改动
测试用例优化 (
test/core/hooks/AutoLink.spec.ts)createAutoLinkHook辅助函数,减少重复代码describe对测试进行分组,提高可读性源代码修复 (
src/core/hooks/AutoLink.js)isLinkInATag方法的正则表达式/<a.*>[^<]*<\/a>/g(贪婪匹配会导致带多个属性的 a 标签匹配失败)/<a\s+[^>]*>[^<]*<\/a>/gi(正确处理带多个属性的 a 标签)✅ 测试结果