-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: increase test coverage to api #111
Conversation
Someone is attempting to deploy this pull request to the Open Systems Lab's projects Team on Vercel. To accomplish this, the commit author's email address needs to be associated with a GitHub account. Learn more about how to change the commit author information. |
…emslab/fairhold-dashboard into gg/test-api-coverage
Oh interesting, I am getting some errors here that I don't see. It has to do with the variable |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@gabrielegranello is attempting to deploy a commit to the Open Systems Lab team on Vercel, but is not a member of this team. To resolve this issue, you can:
To read more about collaboration on Vercel, click here. |
0af18df
to
6122f95
Compare
6122f95
to
e9863f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gabrielegranello, ran the tests locally and they look good to me!
I tried to generate the coverage report to investigate the <100% coverage but didn't have any luck--am I missing something? This is what happened after I ran npm run test:coverage
:
> [email protected] test:coverage
> jest; open ./coverage/lcov-report/index.html
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\Users\zzhha\Dropbox\PC\Desktop\working\jobs\osl\Fairhold_calc\fairhold-dashboard
153 files checked.
testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 29 matches
testPathIgnorePatterns: \\node_modules\\ - 153 matches
testRegex: - 0 matches
Pattern: ;|open|.\\coverage\\lcov-report\\index.html - 0 matches
Oh bizarre @zz-hh-aa , if I do run npm test:coverage I get the screenshot below I am not really sure what's going on. You can successfully run the tests right? But if you specify run npm test:coverage, then you get an error message saying no test found? |
What does this PR do?
It adds a series of unit tests for the API (
route.ts
,services
,data
andrepo
).How?
for every file in the API e.g.
rentService.ts
, there is paired filerentService.test.ts
with the unit tests in it. Tests are written injest
.Any other modification?
I modified the
jest.config.ts
and changed the environment tonode
to test some of prisma specific functions. Also, in terms of branches percentage I had to slightly lower it because I wasn't able to reach 100%. If you try and run the test you can see that there is 1 line inbd.ts
and one line incalculationService.ts
that I am not able to engage with. Happy to hear your thoughts on that :)