theopensystemslab / fairhold-dashboard

https://fairhold-dashboard.vercel.app
0 stars 0 forks source link

feat: increase test coverage to api #111

Closed gabrielegranello closed 1 week ago

gabrielegranello commented 2 weeks ago

What does this PR do?

It adds a series of unit tests for the API (route.ts, services, data and repo).

How?

for every file in the API e.g. rentService.ts, there is paired file rentService.test.ts with the unit tests in it. Tests are written in jest.

Any other modification?

I modified the jest.config.ts and changed the environment to node 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 in bd.ts and one line in calculationService.ts that I am not able to engage with. Happy to hear your thoughts on that :)

vercel[bot] commented 2 weeks ago

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.

gabrielegranello commented 2 weeks ago

Oh interesting, I am getting some errors here that I don't see. It has to do with the variable hpi2020, something that we recently changed. Perhaps we can look at it together?

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fairhold-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 11, 2024 2:15pm
vercel[bot] commented 2 weeks ago

@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.

gabrielegranello commented 1 week ago

Oh bizarre @zz-hh-aa , if I do run npm test:coverage I get the screenshot below Screenshot 2024-10-18 at 09 39 43

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?