TypeORM模拟单元测试示例
本示例展示了如何使用Mocha和Jest模拟TypeORM,以进行单元测试。
用法:
- 运行Mocha单元测试:
npm ci && npm run test:mocha - 运行Jest单元测试:
npm run test:jest - 运行E2E测试:
docker-compose up -d && npm run test:e2e
本地开发:
- 运行Express服务器:
npm start - 构建Express服务器:
npm run build
typeorm-mock-unit-testing-example-master.zip
预估大小:32个文件
typeorm-mock-unit-testing-example-master
文件夹
jest.e2e.config.js
263B
src
文件夹
services
文件夹
index.ts
30B
postService.ts
3KB
startServer.ts
1KB
index.ts
55B
entities
文件夹
Image.ts
319B
文件大小:87.58KB
评论区