Skip to content
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

Refactor : scripts/__mocks__/@pdfme/generator.test.ts from jest to vitest #3525

Closed
varshith257 opened this issue Feb 2, 2025 · 15 comments
Closed
Assignees
Labels
good first issue Good for newcomers refactor Refactor the code to improve its quality

Comments

@varshith257
Copy link
Member

varshith257 commented Feb 2, 2025

Is your feature request related to a problem? Please describe.

This file is currently tested using Jest. As part of our migration to Vitest, we need to refactor the file's test cases to align with Vitest's syntax and features.

Acceptance Criteria

  1. Replace Jest-specific functions and mocks with Vitest equivalents
  2. Rename the test file from having a .test.* suffix to a .spec.* suffix
  3. Ensure all tests in the file pass after migration using npm run test:vitest
  4. Maintain the test coverage for the file as 100% after migration
  5. Upload a video or photo for this specific file coverage is 100% in the PR description

Additional context

  1. Refer to the merged PR for the base Vitest configuration:
    https://github.com/PalisadoesFoundation/talawa-admin/pull/2457/files#diff-9a5a35cf8d7f02b2bba90905714b762560579c4789e9eb4cebb4607980aa3d93
  2. Vitest reference site:
    https://vitest.dev/

Potential internship candidates

Please read this if you are planning to apply for a Palisadoes Foundation internship

@varshith257 varshith257 added the bug Something isn't working label Feb 2, 2025
@github-actions github-actions bot added feature request refactor Refactor the code to improve its quality test Testing application unapproved labels Feb 2, 2025
@varshith257 varshith257 added good first issue Good for newcomers and removed bug Something isn't working unapproved test Testing application feature request labels Feb 2, 2025
@varshith257
Copy link
Member Author

varshith257 commented Feb 2, 2025

@syedali237 I am assigning this to you

Comment here to get assigned

@varshith257
Copy link
Member Author

@syedali237 There appear to be flags related of jest and combined still in codecov . I think there are few references of them andremove them and make only one flag or else remove flags too

@syedali237
Copy link
Contributor

@varshith257 ok assign it to me.

@syedali237
Copy link
Contributor

@varshith257 should i also remove the "test" script from the package.json that runs jest test cases?

@syedali237
Copy link
Contributor

syedali237 commented Feb 2, 2025

and also all the jest devDependencies mentioned and also remove jest anywhere mentioned in a file?

@varshith257
Copy link
Member Author

Yes, remove it and replace with vitest

@palisadoes
Copy link
Contributor

@syedali237 @varshith257

Do any of these files need to be updated too? There are multiple references to jest related packages

Image

@varshith257
Copy link
Member Author

@syedali237 Remove them we also have equivalent exact syntax in vitest for mockResolveValueOnce etc..

@syedali237
Copy link
Contributor

@varshith257 should I open a new issue and raise PR for it, as it includes removing dependencies as well?

@varshith257
Copy link
Member Author

Link this issue rather new one

@syedali237
Copy link
Contributor

ok

@palisadoes
Copy link
Contributor

@syedali237

  1. Here are some more files to fix:
    Image
  2. Here are some more files to fix:
    Image

@palisadoes palisadoes marked this as a duplicate of #3541 Feb 4, 2025
@syedali237
Copy link
Contributor

sure, will look into that too.

@palisadoes
Copy link
Contributor

@varshith257

PTAL to verify. I merged the PR

@palisadoes
Copy link
Contributor

Closing. It appears to be working.

@github-project-automation github-project-automation bot moved this from Backlog to Done in Talawa-Admin (Tests) Feb 8, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Talawa Admin - Refactoring Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers refactor Refactor the code to improve its quality
Projects
Status: Done
Status: Done
Development

No branches or pull requests

3 participants