Replies: 4 comments 6 replies
-
What level of coverage would be able to achieve when we say screw it? If this percentage is still 90% or something like that I would think that is still a reasonable goal and it would still allow us to keep the (good) structure we have now. |
Beta Was this translation helpful? Give feedback.
-
I fail to understand why you can't test the |
Beta Was this translation helpful? Give feedback.
-
So to come back to this. I don't really feel the need the check if the route is correctly setup - because we would partly be testing the framework itself, which is pointless - and we do "integration" tests by calling the routes from the frontend. Just trick jest by executing the function in a test without doing anything with the result to get to 100% code coverage. |
Beta Was this translation helpful? Give feedback.
-
Closing with conclusion: Testing getRouter would be pointless - as it mostly tests the express framework. True testing can and will be done using begin-to-end tests using SuperTest. |
Beta Was this translation helpful? Give feedback.
-
Currently, all route files have a single function called
getRouter
. This function is called to set up anexpress.Router
for that route. However, this makes it nigh-impossible to get 100% coverage on the routes files.There's a few ways to remedy this (some more tiresome than others):
getRouter
calls to a single (other) file and refactorendpoints.ts
to reflect the changes. Why not move them toendpoints.ts
? Because that would cause the exact same issue when we're testingendpoints.ts
- thegetRouter
calls are inside theendpoints.ts
and would have to be mocked by then (probably).getRouter.test.ts
.Another option would be to just say screw it, we don't need 100% coverage
0 votes ·
Beta Was this translation helpful? Give feedback.
All reactions