Skip to content

Tests for invoice validation#179

Open
Atharva0506 wants to merge 8 commits into
StabilityNexus:mainfrom
Atharva0506:test/invoice-validation
Open

Tests for invoice validation#179
Atharva0506 wants to merge 8 commits into
StabilityNexus:mainfrom
Atharva0506:test/invoice-validation

Conversation

@Atharva0506

Copy link
Copy Markdown
Member

Addressed Issues:

Fixes #148

Screenshots/Recordings:

N/A - This PR strictly introduces automated testing coverage (no UI changes).

Additional Notes:

This PR introduces 100% statement and branch test coverage for the invoice validation and calculation utility functions in the frontend. It resolves edge cases uncovered during testing, such as:

  • Properly validating zero/invalid total amounts in batch modes.
  • Skipping completely blank line items instead of flagging them as invalid.
  • Handling duplicate wallet addresses gracefully in batch invoice configurations.
  • Precise percentage-cap validation using BigInt/Wei limits.

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: Gemini 3.1 Pro (used for identifying edge cases and writing comprehensive test suites).

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e169fb93-ae39-42a7-8e6d-86c612a2edc6

📥 Commits

Reviewing files that changed from the base of the PR and between 584c0dc and 3994998.

📒 Files selected for processing (4)
  • frontend/jest.config.cjs
  • frontend/package.json
  • frontend/tests/utils/invoiceCalculations.test.js
  • frontend/tests/utils/invoiceValidation.test.js
👮 Files not reviewed due to content moderation or server errors (4)
  • frontend/tests/utils/invoiceValidation.test.js
  • frontend/tests/utils/invoiceCalculations.test.js
  • frontend/jest.config.cjs
  • frontend/package.json

Warning

Walkthrough skipped

File diffs could not be summarized.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Negative invoice line amount shown and invalid invoice submission allowed

1 participant