-
-
Notifications
You must be signed in to change notification settings - Fork 811
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
Refactored src/screens/UserPortal/Volunteer/Invitations from jest to vitest #2691
Refactored src/screens/UserPortal/Volunteer/Invitations from jest to vitest #2691
Conversation
WalkthroughThis pull request involves two primary changes: a structural modification in the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/CheckIn/tagTemplate.ts
(1 hunks)src/screens/UserPortal/Volunteer/Invitations/Invitations.spec.tsx
(2 hunks)
🧰 Additional context used
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/components/CheckIn/tagTemplate.ts
[failure] 7-7:
Object literal may only specify known properties, and '"name"' does not exist in type '{ type: "text"; height: number; width: number; position: { x: number; y: number; }; rotate?: number | undefined; alignment?: "center" | "left" | "right" | undefined; fontSize?: number | undefined; ... 5 more ...; dynamicFontSize?: { ...; } | undefined; }'.
🔇 Additional comments (2)
src/screens/UserPortal/Volunteer/Invitations/Invitations.spec.tsx (2)
97-97
: LGTM! Test cleanup properly migrated to Vitest.
The test cleanup is correctly updated to use vi.clearAllMocks()
instead of jest.clearAllMocks()
.
24-40
: LGTM! Mock implementations properly migrated to Vitest.
The migration from Jest to Vitest looks good. The mock implementations are correctly updated and the new mock for react-router-dom provides appropriate custom implementations for hooks.
✅ Verification successful
Based on the search results, I can see that there are still many test files using Jest mocks (jest.mock
and jest.fn
), while some files have been migrated to use Vitest mocks (vi.mock
and vi.fn
). The file under review (src/screens/UserPortal/Volunteer/Invitations/Invitations.spec.tsx) has been properly migrated to use Vitest mocks.
Migration to Vitest mocks looks good, but other test files need similar updates
The changes in this file correctly replace Jest mocks with Vitest equivalents:
jest.mock
->vi.mock
jest.fn
->vi.fn
However, there are many other test files that still need to be migrated from Jest to Vitest mocks. This is not a blocker for this PR since we want to keep changes focused and manageable.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify all Jest mocks have been migrated to Vitest
# Test: Search for any remaining Jest mocks
rg "jest\.mock"
rg "jest\.fn"
# Test: Verify Vitest mocks are used instead
rg "vi\.mock"
rg "vi\.fn"
Length of output: 64949
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/CheckIn/tagTemplate.ts (1)
22-22
: Use consistent quote styleFor consistency with JSON format, use double quotes for the
basePdf
property value.Apply this diff to fix the quote style:
- "basePdf": - 'data:application/pdf;base64,JVBERi0xLjQKJfbk/N8KMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovVmVyc2lvbiAvMS40Ci9QYWdlcyAyIDAgUgovU3RydWN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McEueZ3I+7Q51E1848Tjf4ew8I6ODDrp9Ikixt20XWbM7noqpq/U5GoyulqNrgajq9roLjW6qozueqO7xeRymnpeiWEHX8Lj6VeO8X4G <details> <summary>🧰 Tools</summary> <details> <summary>🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch</summary> [failure] 22-22: ';' expected. </details> </details> </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: .coderabbit.yaml** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 0acbfac30276e685fdc64e3997606c4ad3401d21 and 7b9274fafadca2de4ba97aef33bbc44f3f8956a2. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/components/CheckIn/tagTemplate.ts` (1 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 Biome (1.9.4)</summary> <details> <summary>src/components/CheckIn/tagTemplate.ts</summary> [error] 21-21: Expected a property, a shorthand property, a getter, a setter, or a method but instead found ']'. Expected a property, a shorthand property, a getter, a setter, or a method here. (parse) </details> </details> <details> <summary>🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch</summary> <details> <summary>src/components/CheckIn/tagTemplate.ts</summary> [failure] 21-21: Property assignment expected. --- [failure] 21-21: Declaration or statement expected. --- [failure] 22-22: ';' expected. </details> </details> </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Please fix:
Make sure CodeRabbit.ai approves your changes |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/CheckIn/tagTemplate.ts
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/components/CheckIn/tagTemplate.ts
[failure] 7-7:
Object literal may only specify known properties, and '"name"' does not exist in type '{ type: "text"; height: number; width: number; position: { x: number; y: number; }; rotate?: number | undefined; alignment?: "center" | "left" | "right" | undefined; fontSize?: number | undefined; ... 5 more ...; dynamicFontSize?: { ...; } | undefined; }'.
🔇 Additional comments (1)
src/components/CheckIn/tagTemplate.ts (1)
21-21
: LGTM: Base PDF data is properly encoded
The base64 encoded PDF data is correctly formatted.
@palisadoes I have updated the template schema to align with the documentation provided by pdfme. However, the GitHub action is still failing with the same type error, as shown below: It’s unclear why this discrepancy is happening, as the error is no longer reproducible locally. Could this be related to differences in the CI environment, such as cached dependencies or an outdated @pdfme/common package? Any insights or suggestions to resolve this issue? From the documentation below its clear that 'name' property does exist. |
Please fix the failing tests. Our test code coverage system will fail if any of these conditions occur:
Here are some steps to take:
We do this to ensure the overall reliability of the code base is maintained. This is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing. Additional notes:
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/CheckIn/tagTemplate.ts
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/components/CheckIn/tagTemplate.ts
[failure] 7-7:
Object literal may only specify known properties, and '"name"' does not exist in type '{ type: "text"; height: number; width: number; position: { x: number; y: number; }; rotate?: number | undefined; alignment?: "center" | "left" | "right" | undefined; fontSize?: number | undefined; ... 5 more ...; dynamicFontSize?: { ...; } | undefined; }'.
🔇 Additional comments (1)
src/components/CheckIn/tagTemplate.ts (1)
4-19
: Verify the nested array schema structure.
The schema has been restructured as a nested array [[{...}]]
. While this matches the @pdfme/common documentation, we should verify that all consumers of this template are updated to handle the new structure.
✅ Verification successful
Let me verify the usage of the @pdfme/common
library and its expected schema structure.
Let me check the actual usage in the code to verify if the nested array structure is being handled correctly.
The nested array schema structure is valid and compatible with existing usage.
The verification shows that:
- The template is only used in
TableRow.tsx
with the@pdfme/generator
'sgenerate
function - The code correctly handles the template by passing it directly to the generate function along with properly formatted inputs
- The nested array structure
[[{...}]]
is compatible with theTemplate
type from@pdfme/common
The schema restructuring doesn't impact the consumers as they interact with the template through the @pdfme/generator
API which expects this exact format.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Find all usages of tagTemplate to verify compatibility with new schema structure
rg -A 5 "tagTemplate" --type ts
Length of output: 1353
Script:
#!/bin/bash
# Check imports of @pdfme/common to understand the expected Template type
rg "@pdfme/common" --type ts -A 2
# Find any other template definitions in the codebase for comparison
ast-grep --pattern 'Template = {
$$$
}'
Length of output: 698
Script:
#!/bin/bash
# Check how the template is being used in TableRow.tsx
cat src/components/CheckIn/TableRow.tsx
Length of output: 3671
🧰 Tools
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
[failure] 7-7:
Object literal may only specify known properties, and '"name"' does not exist in type '{ type: "text"; height: number; width: number; position: { x: number; y: number; }; rotate?: number | undefined; alignment?: "center" | "left" | "right" | undefined; fontSize?: number | undefined; ... 5 more ...; dynamicFontSize?: { ...; } | undefined; }'.
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/CheckIn/tagTemplate.ts (1)
25-25
: Consider using template literals for base64 data.The long base64 string could be better formatted using template literals for improved readability.
- "basePdf": 'data:application/pdf;base64,JVBERi0...', + "basePdf": `data:application/pdf;base64, + JVBERi0... + `,
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/CheckIn/tagTemplate.ts
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/components/CheckIn/tagTemplate.ts
[failure] 11-11:
Object literal may only specify known properties, and '"name"' does not exist in type '{ type: "text"; height: number; width: number; position: { x: number; y: number; }; rotate?: number | undefined; alignment?: "center" | "left" | "right" | undefined; fontSize?: number | undefined; ... 5 more ...; dynamicFontSize?: { ...; } | undefined; }'.
🔇 Additional comments (2)
src/components/CheckIn/tagTemplate.ts (2)
3-6
: 🛠️ Refactor suggestion
Consider using interface extension instead of type alias for better type safety.
The current type definition might not properly extend the base schema type. Consider using an interface that extends the base schema type from @pdfme/common:
-type ExtendedSchema = {
- name? : string;
-}
+interface ExtendedSchema extends TextSchema {
+ name?: string;
+}
This approach ensures proper type extension and better type checking.
Likely invalid or redundant comment.
1-25
: Verify PDF template compatibility.
The template structure has been modified. Please ensure that:
- The PDF template is compatible with the current version of @pdfme/common
- All required fields are properly mapped
- The base64 PDF data is valid
Run this script to verify template compatibility:
✅ Verification successful
Based on the gathered information, I can now provide the final response:
Template structure and dependencies are correctly configured
The verification shows that:
- @pdfme dependencies are properly installed (@pdfme/generator: ^5.2.3)
- Template structure follows @pdfme/common type definition
- Template is correctly used with the generate function in TableRow.tsx
- Input validation is implemented before PDF generation
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify template structure and PDF compatibility
# Check @pdfme/common version and types
npm ls @pdfme/common
# Find all usages of the template
rg -A 5 "tagTemplate"
# Verify PDF data is valid base64
echo "${basePdf#*,}" | base64 -d > /dev/null 2>&1
Length of output: 3818
Script:
#!/bin/bash
# Let's verify the template structure and its usage more thoroughly
# Check if @pdfme/common is in package.json dependencies
rg "@pdfme/common" package.json
# Find imports of @pdfme/common across the codebase
rg "from '@pdfme/common'"
# Look for Template type usage and structure
rg -A 10 "Template.*from.*@pdfme/common"
# Check how the template is being used with generate function
ast-grep --pattern 'generate({ template: $_, inputs: $_ })'
Length of output: 3467
Script:
#!/bin/bash
# Let's check the package dependencies and generator usage
# Check package.json for all @pdfme related dependencies
rg -A 1 -B 1 "\"@pdfme/" package.json
# Look for the generate import and its usage
rg -A 2 "import.*generate.*from.*@pdfme"
# Check TableRow.tsx more thoroughly for template usage
cat src/components/CheckIn/TableRow.tsx
Length of output: 4137
🧰 Tools
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
[failure] 11-11:
Object literal may only specify known properties, and '"name"' does not exist in type '{ type: "text"; height: number; width: number; position: { x: number; y: number; }; rotate?: number | undefined; alignment?: "center" | "left" | "right" | undefined; fontSize?: number | undefined; ... 5 more ...; dynamicFontSize?: { ...; } | undefined; }'.
In tagTemplate.ts try changing |
@syedali237 try removing double quotes from name , schema , type.... |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/CheckIn/tagTemplate.ts (1)
25-25
: Consider externalizing the base64 PDF data.The large base64 encoded PDF string embedded in the code makes the file harder to maintain. Consider moving it to a separate asset file.
- Create a separate file like
nameTagTemplate.pdf.ts
- Export the base64 string from there
- Import and use it in this file
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/CheckIn/tagTemplate.ts
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/components/CheckIn/tagTemplate.ts
[failure] 11-11:
Object literal may only specify known properties, and 'name' does not exist in type '{ type: "text"; height: number; width: number; position: { x: number; y: number; }; rotate?: number | undefined; alignment?: "center" | "left" | "right" | undefined; fontSize?: number | undefined; ... 5 more ...; dynamicFontSize?: { ...; } | undefined; }'.
🔇 Additional comments (1)
src/components/CheckIn/tagTemplate.ts (1)
7-24
:
Fix type error in schema definition.
The 'name' property is causing a type error because it's not part of the base TextSchema type. This needs to be fixed to ensure type safety.
Apply one of these solutions:
- Use the field property as per pdfme documentation:
- name: "name",
+ field: "name",
- Or use the ExtendedSchema interface as suggested above:
-export const tagTemplate: Template & ExtendedSchema = {
+export const tagTemplate: Template<ExtendedSchema> = {
Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
[failure] 11-11:
Object literal may only specify known properties, and 'name' does not exist in type '{ type: "text"; height: number; width: number; position: { x: number; y: number; }; rotate?: number | undefined; alignment?: "center" | "left" | "right" | undefined; fontSize?: number | undefined; ... 5 more ...; dynamicFontSize?: { ...; } | undefined; }'.
@IITI-tushar this didn't work.. |
@syedali237 why have you make changes in tag templates? |
@IITI-tushar it was giving an error while committing, I did mention that earlier. I tried committing the original file from the develop-postgres branch but still the same error arises. so had to fix it Although it pass |
@syedali237 I have recently made 2 prs and there was no error with tagtemplates |
the file tagTemplate is already in .eslintignore, lint:fix doesn't cover it, but when typecheck is performed with the original tagTemplate.ts file from develop-postgres then it shows this error, otherwise with my changes it does not throw this error locally but here it fails on Github Actions. |
Closing this PR, had issues with my repository. |
What kind of change does this PR introduce?
Refactoring & Bugfix
Issue Number:
Fixes #2583
Did you add tests for your changes?
Yes
Snapshots/Videos:
If relevant, did you update the documentation?
No
Summary
Refactored the test case to be run using vitest.
Does this PR introduce a breaking change?
No
Other information
Changed the tagTemplate.ts file, it was giving error while commiting updated the schema to the latest documentation.
Have you read the contributing guide?
Yes
Summary by CodeRabbit
New Features
Bug Fixes
Chores