Skip to content

[test]: Added tests for gifts - #8493

Open
rijulpoudel wants to merge 14 commits into
mainfrom
issue-8492
Open

rijulpoudel wants to merge 14 commits into
mainfrom
issue-8492

Conversation

@rijulpoudel

@rijulpoudel rijulpoudel commented Sep 2, 2026

Copy link
Copy Markdown
Member

Fixes #8492

Summary by CodeRabbit

  • Tests
    • Expanded coverage for gift dates, persisted details, relationships, shipments, preparations, and attachments.
    • Added validation for agents linked through shipment relationships, including roles and quantities.
    • Verified shipment destinations and fully populated gift scenarios after retrieval.
    • Added tests for creating and deleting gift attachments.
    • Added regression coverage confirming the “Generate invoice” checkbox is recognized and displays the correct label.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 402d84a6-4202-4f47-869e-835d1d2f9d05

📥 Commits

Reviewing files that changed from the base of the PR and between 14ac5c0 and e5e0612.

📒 Files selected for processing (2)
  • specifyweb/backend/businessrules/tests/test_gift.py
  • specifyweb/frontend/js_src/lib/components/FormParse/__tests__/fields.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds backend tests for Gift persistence, relationships, shipments, and attachments. It also adds a frontend regression test for parsing the generateInvoice checkbox.

Changes

Gift persistence tests

Layer / File(s) Summary
Gift relationships and shipment tests
specifyweb/backend/businessrules/tests/test_gift.py
Adds tests for gift fields, agent relationships, shipment fields, and shippedby or shippedto relationships.
Combined gift and attachment tests
specifyweb/backend/businessrules/tests/test_gift.py
Adds integrated coverage for preparation quantities, remaining gift fields, and attachment creation and deletion.

Form field regression tests

Layer / File(s) Summary
generateInvoice field parsing test
specifyweb/frontend/js_src/lib/components/FormParse/__tests__/fields.test.ts
Verifies that parseFormField returns a checkbox with printOnSave: true and the generated save label.

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to e5e06

This PR adds test coverage only, with no supported behavior or reliability issue requiring changes before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also adds recognizes generate invoice checkbox in specifyweb/frontend/js_src/lib/components/FormParse/__tests__/fields.test.ts. This test covers parseFormField and the generateInvoice c… Remove the unrelated FormParse test from this PR, or move it to a separate pull request for the corresponding FormParse requirement.
Testing Instructions ⚠️ Warning The pull request description contains only “Fixes #8492” and no testing instructions. The pull request changes two components: Django Gift business-rule tests in `specifyweb/backend/businessrules/test… Add a Testing section. Include the backend command ./ve/bin/python manage.py test specifyweb.backend.businessrules.tests.test_gift and the frontend command, run from specifyweb/frontend/js_src, `npm run typecheck && npm run unitTests --…
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding tests for gifts. It is concise and related to the changeset, although it does not mention the additional invoice checkbox regression test.
Linked Issues check ✅ Passed Issue #8492 requests tests for Gifts. The PR adds GiftTests coverage for gift validation, dates and fields, gift agents, preparations, shipments, shipment agents, and attachment creation and deletio…
Automatic Tests ✅ Passed The pull request adds automatic tests. It adds 11 Gift test methods covering persistence and relationships, plus a Jest regression test for the generateInvoice checkbox. The changed files are test f…
Full details: Out of Scope Changes check

Explanation

The PR also adds recognizes generate invoice checkbox in specifyweb/frontend/js_src/lib/components/FormParse/__tests__/fields.test.ts. This test covers parseFormField and the generateInvoice checkbox. It has no connection to Gift testing requested by issue #8492.

Full details: Testing Instructions

Explanation

The pull request description contains only “Fixes #8492” and no testing instructions. The pull request changes two components: Django Gift business-rule tests in specifyweb/backend/businessrules/tests/test_gift.py and Jest/FormParse tests in specifyweb/frontend/js_src/lib/components/FormParse/__tests__/fields.test.ts. Repository CI confirms separate backend and frontend test commands, so the description does not clearly cover the affected components.

Resolution

Add a Testing section. Include the backend command ./ve/bin/python manage.py test specifyweb.backend.businessrules.tests.test_gift and the frontend command, run from specifyweb/frontend/js_src, npm run typecheck && npm run unitTests -- lib/components/FormParse/__tests__/fields.test.ts. State whether these targeted tests or the full suites were run, and report the results.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8492

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.

@rijulpoudel

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rijulpoudel

Copy link
Copy Markdown
Member Author

@CodeRabbit full review

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 54 minutes.

@rijulpoudel

Copy link
Copy Markdown
Member Author

@CodeRabbit Full review

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

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

Labels

None yet

Projects

Status: 📋Back Log

Development

Successfully merging this pull request may close these issues.

[test]: Add tests for Gifts

1 participant