nestjs-prisma-starter
nestjs-prisma-starter copied to clipboard
Unit tests coverage
Sorry for bothering again.
I was wondering if there is a way to make code coverage 100% with unit tests for this project. I don't know if this is possible but, it would be nice to have a good set of unit tests.
Do you think that this is a good idea? I cannot image how to test something like the classes in pagination.ts as they are only graphql type definitions.
But maybe, this is not a problem at all. I wish to discuss this with you.
Now, code coverage is getting very low score:
$ yarn test:cov
yarn run v1.22.5
$ jest --coverage
PASS src/controllers/app.controller.spec.ts
PASS src/common/scalars/date.scalar.spec.ts
PASS src/resolvers/app.resolver.spec.ts
PASS src/configs/config.spec.ts
---------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------------|---------|----------|---------|---------|-------------------
All files | 8.94 | 2.44 | 14.63 | 8.12 |
src | 0 | 0 | 0 | 0 |
app.module.ts | 0 | 0 | 0 | 0 | 1-41
main.ts | 0 | 0 | 0 | 0 | 1-38
src/common/order | 0 | 0 | 0 | 0 |
order-direction.ts | 0 | 0 | 0 | 0 | 1-10
order.ts | 0 | 100 | 0 | 0 | 1-7
src/common/pagination | 0 | 100 | 0 | 0 |
page-info.model.ts | 0 | 100 | 100 | 0 | 1-4
pagination.args.ts | 0 | 100 | 100 | 0 | 1-4
pagination.ts | 0 | 100 | 0 | 0 | 1-30
src/common/scalars | 83.33 | 50 | 80 | 80 |
date.scalar.ts | 83.33 | 50 | 80 | 80 | 4,20
src/configs | 100 | 100 | 100 | 100 |
config.ts | 100 | 100 | 100 | 100 |
src/controllers | 100 | 100 | 100 | 100 |
app.controller.ts | 100 | 100 | 100 | 100 |
src/decorators | 0 | 100 | 0 | 0 |
user.decorator.ts | 0 | 100 | 0 | 0 | 1-6
src/guards | 0 | 100 | 0 | 0 |
gql-auth.guard.ts | 0 | 100 | 0 | 0 | 1-9
src/models | 0 | 0 | 0 | 0 |
auth.model.ts | 0 | 100 | 100 | 0 | 1-6
model.model.ts | 0 | 100 | 0 | 0 | 1-6
post.model.ts | 0 | 100 | 100 | 0 | 1-6
token.model.ts | 0 | 100 | 100 | 0 | 1-9
user.model.ts | 0 | 0 | 0 | 0 | 1-28
src/models/args | 0 | 100 | 100 | 0 |
post-id.args.ts | 0 | 100 | 100 | 0 | 1-7
user-id.args.ts | 0 | 100 | 100 | 0 | 1-7
src/models/inputs | 0 | 0 | 0 | 0 |
post-order.input.ts | 0 | 0 | 0 | 0 | 1-20
src/models/pagination | 0 | 100 | 100 | 0 |
post-connection.model.ts | 0 | 100 | 100 | 0 | 1-6
src/resolvers | 80 | 100 | 50 | 75 |
app.resolver.ts | 80 | 100 | 50 | 75 | 5,9
src/resolvers/auth | 0 | 0 | 0 | 0 |
auth.module.ts | 0 | 100 | 0 | 0 | 1-39
auth.resolver.ts | 0 | 100 | 0 | 0 | 1-48
jwt.strategy.ts | 0 | 0 | 0 | 0 | 2-26
src/resolvers/auth/dto | 0 | 100 | 100 | 0 |
login.input.ts | 0 | 100 | 100 | 0 | 1-13
signup.input.ts | 0 | 100 | 100 | 0 | 1-19
src/resolvers/post | 0 | 0 | 0 | 0 |
post.module.ts | 0 | 100 | 100 | 0 | 1-8
post.resolver.ts | 0 | 0 | 0 | 0 | 1-72
src/resolvers/user | 0 | 100 | 0 | 0 |
user.module.ts | 0 | 100 | 100 | 0 | 1-10
user.resolver.ts | 0 | 100 | 0 | 0 | 1-55
src/resolvers/user/dto | 0 | 100 | 100 | 0 |
change-password.input.ts | 0 | 100 | 100 | 0 | 1-14
update-user.input.ts | 0 | 100 | 100 | 0 | 1-8
src/services | 8 | 0 | 10.53 | 6.15 |
app.service.ts | 100 | 100 | 100 | 100 |
auth.service.ts | 0 | 0 | 0 | 0 | 1-100
password.service.ts | 0 | 0 | 0 | 0 | 1-24
prisma.service.ts | 0 | 100 | 0 | 0 | 1-15
user.service.ts | 0 | 0 | 0 | 0 | 1-41
---------------------------|---------|----------|---------|---------|-------------------
Test Suites: 4 passed, 4 total
Tests: 8 passed, 8 total
Snapshots: 0 total
Time: 4.629 s
Ran all test suites.
Done in 5.09s.