0.1.0 • Published 6 years ago

cc-test-example v0.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

单元测试

  • 一般用在公共组件或者方法中 (业务组件修改较为频繁,成本过大,暂不使用)。

如何使用

  • yarn test (执行项目代码的所有测试代码)

WiKi地址

单元测试

代码结构

.
├── .babelrc
├── .eslintrc.js
├── .jest.js  // jest配置文件
├── README.md
├── __mocks__
│   ├── fileMock.js // 文件指向这里,避免测试时出现404的情况
│   ├── lodash.js
│   └── styleMock.js // 同上
├── package.json
├── src
│   ├── actions
│   │   └── todo
│   │       └── index.js
│   ├── components
│   │   ├── add
│   │   │   ├── __test__
│   │   │   │   └── index.test.js // 对应add组件的单元测试
│   │   │   └── index.js          // 公用的add组件
│   │   ├── async
│   │   │   ├── __mocks__
│   │   │   │   └── request.js
│   │   │   ├── __test__
│   │   │   │   └── index.test.js
│   │   │   ├── index.js
│   │   │   └── request.js
│   │   ├── todo-input
│   │   │   ├── __tests__
│   │   │   │   ├── __snapshots__
│   │   │   │   └── index.test.js
│   │   │   └── index.js
│   │   └── todo-list
│   │       ├── __test__
│   │       │   ├── __snapshots__  // 目录下存放UI组件的快照
│   │       │   └── index.test.js  // todo-list的单元测试
│   │       ├── index.js
│   │       └── index.less
│   ├── configs
│   │   └── index.js
│   ├── containers
│   │   ├── index.js
│   │   └── todo
│   │       └── index.js
│   ├── favicon.ico
│   ├── index.js
│   ├── reducers
│   │   └── index.js
│   ├── routes
│   │   └── index.js
│   ├── store
│   │   └── index.js
│   ├── styles
│   │   ├── animation.less
│   │   ├── common.less
│   │   ├── index.less
│   │   ├── main.less
│   │   ├── mixins.less
│   │   ├── normalize.less
│   │   ├── reset.less
│   │   └── variables.less
│   ├── templates
│   │   └── index.html
│   └── utils
│       ├── __mocks__
│       │   └── index.js
│       └── index.js
├── test
│   └── setup.js  // jest初始话配置  比如enzyme对应的react的适配器设置
├── yarn.lock
└── ytian.config.js

开发人员

  • 胡持 (Chi.hu@geely.com)
  • 施晨聪 (Chencong.Shi@geely.com)