Files
vtj/packages/node/tests/base.test.ts
“chenhuachun” 405b2c22ef chore(scope): 更新描述信息及完善测试覆盖
- 更新各包 package.json 中描述为 AI 驱动的 Vue3 企业级开发平台
- 调整 library 包版本号及版权信息
- 修改库中的测试命令为 vitest run
- 新增多个包的单元测试,覆盖组件导入、钩子函数、工具函数等
- 为多个包添加导出测试确保类型和成员完整
- 修正插件测试中导入判断逻辑
- 增强 UI 组件的测试,覆盖容器组件、内置字段编辑器等
- 引入新的公共测试依赖 @vue/test-utils
- 在 createViteConfig 相关测试中增加更多场景验证
- 重构部分测试用例结构,使用 describe 分组提升可读性
- 删除 CLI tsconfig 的 ignoreDeprecations 配置
- 删除 package 中一些无效或注释掉的测试代码
- 为文件操作相关功能新增测试验证基本读写、拷贝等功能正常
- 扩展对图表包 hooks 和组件的导出测试
- 添加图标包中图标组件的导出和功能测试
- 为附件组件相关工具函数添加文件类型识别和转换测试
- 优化和丰富 grid 组件的工具函数和常量测试覆盖率
- 新增 UI 包中安装器和公共工具函数的测试用例
- 修复 local 包中导入名称错误的问题,改为 createDevTools
- 在 charts 包新增对 hooks 的导出支持
- 调整部分包新增依赖和关键词,强调 AI 低代码等特性
2026-06-15 11:54:45 +08:00

47 lines
1.2 KiB
TypeScript

import { describe, expect, test } from 'vitest';
import {
upperFirstCamelCase,
base64,
fs,
copy,
emptyDir,
pathExists,
pathExistsSync,
readJson,
readJsonSync,
readdir,
readdirSync
} from '../src';
describe('base re-exports', () => {
test('upperFirstCamelCase', () => {
expect(upperFirstCamelCase('helloWorld')).toEqual('HelloWorld');
expect(upperFirstCamelCase('abc')).toEqual('Abc');
expect(upperFirstCamelCase('')).toEqual('');
});
test('base64', () => {
const encoded = base64('abc');
expect(typeof encoded).toBe('string');
expect(encoded.length).toBeGreaterThan(0);
});
});
describe('fs re-exports', () => {
test('fs 对象存在', () => {
expect(fs).toBeDefined();
expect(typeof fs.copy).toBe('function');
});
test('文件操作函数全部可导入且为函数', () => {
expect(typeof copy).toBe('function');
expect(typeof emptyDir).toBe('function');
expect(typeof pathExists).toBe('function');
expect(typeof pathExistsSync).toBe('function');
expect(typeof readJson).toBe('function');
expect(typeof readJsonSync).toBe('function');
expect(typeof readdir).toBe('function');
expect(typeof readdirSync).toBe('function');
});
});