9ff6b8985c
- 创建 CLAUDE.md 项目开发指导文档 - 提取公共常量到 components/constants.ts - 修复 TimestampToDatetime 重复插件扩展问题 - 修复 DatetimeToTimestamp 时区解析问题 - 优化 RoutePersistence 移除不必要依赖 - 添加 Vitest 测试框架配置 - 为所有组件编写单元测试 (16个测试用例) - 更新 .gitignore 忽略测试结果目录 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 lines
672 B
TypeScript
18 lines
672 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { TimestampToDatetime } from '../TimestampToDatetime';
|
|
|
|
describe('TimestampToDatetime', () => {
|
|
it('应该正确渲染组件', () => {
|
|
render(<TimestampToDatetime />);
|
|
expect(screen.getByLabelText('输入时间戳')).toBeInTheDocument();
|
|
expect(screen.getByText('转换')).toBeInTheDocument();
|
|
expect(screen.getByLabelText('转换结果')).toBeInTheDocument();
|
|
});
|
|
|
|
it('应该初始化为当前时间戳', () => {
|
|
render(<TimestampToDatetime />);
|
|
const input = screen.getByLabelText('输入时间戳') as HTMLInputElement;
|
|
expect(input.value).toMatch(/^\d{13}$/);
|
|
});
|
|
});
|