Samagra-Development / Doc-Generator

Create PDFs from a variety of formats.
17 stars 46 forks source link

Fix AppController end-to-end testcase #132

Closed yuvrajsab closed 1 year ago

yuvrajsab commented 1 year ago

There is an e2e test case in this file test/app.e2e-spec.ts that simply hit the/api endpoint and tests if it prints Doc Generator or not. So currently this test case is failing because the required dependencies are not available to it for example Prisma service is not available to it, we can pass the instance but in this case, we don't want to pass the actual Prisma service instance rather we want to mock it because we don't want this test to be dependent on the database.

See https://github.com/Samagra-Development/Doc-Generator/blob/Roadmap-2023/test/app.e2e-spec.ts#L10-L13 for reference.

VarunGitGood commented 1 year ago

Can i work on this?

AnshulMalik commented 1 year ago

Yes @varun7singh , assigning this to you.

VarunGitGood commented 1 year ago

Hii @yuvrajsab i did mock the PrismaService to resolve the dependecies issue just realized unable to find the "/api" endpoint in the controller

should i create one?

VarunGitGood commented 1 year ago

Okay so i changed the endpoint to "/" in the test as there was no endpoint present in the controller image

** Also i did change the file structure a little bit just for the PrismaService and Module i used the nest cli therefore all dependencies resolved by updating paths