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
zip
typeorm-mock-unit-testing-example-master.zip 预估大小:32个文件
folder
typeorm-mock-unit-testing-example-master 文件夹
file
jest.e2e.config.js 263B
folder
src 文件夹
folder
services 文件夹
file
index.ts 30B
file
postService.ts 3KB
file
startServer.ts 1KB
file
index.ts 55B
folder
entities 文件夹
file
Image.ts 319B
file
Post.ts 347B
file
index.ts 47B
folder
controllers 文件夹
file
index.ts 33B
file
postController.ts 1KB
file
.travis.yml 328B
file
tsconfig.json 1KB
file
LICENSE 1KB
folder
test 文件夹
file
utils.ts 474B
folder
unit 文件夹
folder
jest 文件夹
file
test.getById.ts 1KB
file
test.create.ts 1KB
file
test.getAll.ts 1KB
file
test.update.ts 2KB
folder
mocha 文件夹
file
test.getById.ts 1KB
file
test.create.ts 1KB
file
test.getAll.ts 1KB
file
test.update.ts 2KB
folder
e2e 文件夹
file
seed.ts 598B
file
test.postController.ts 3KB
file
callSetup.ts 275B
file
tslint.json 436B
file
README.md 4KB
file
docker-compose.yml 191B
file
.gitignore 20B
file
jest.unit.config.js 229B
file
package-lock.json 277KB
file
package.json 2KB
zip 文件大小:87.58KB