Skip to content

测试指南

IfAI 测试策略和实践。

单元测试

前端 (Vitest)

typescript
import { describe, it, expect } from 'vitest'
import { render } from '@testing-library/react'

describe('组件', () => {
  it('正确渲染', () => {
    const { getByText } = render(<Component />)
    expect(getByText('Hello')).toBeInTheDocument()
  })
})

后端 (Rust)

rust
#[test]
fn test_function() {
    assert_eq!(2 + 2, 4);
}

E2E 测试 (Playwright)

运行测试

bash
npm run test        # 前端
cargo test          # 后端
npm run test:e2e    # E2E

下一步

基于 MIT 许可发布