Skip to content

Tests: Add unit tests - #8606

Open
CarolineDenis wants to merge 1 commit into
mainfrom
issue-7441
Open

CarolineDenis wants to merge 1 commit into
mainfrom
issue-7441

Conversation

@CarolineDenis

@CarolineDenis CarolineDenis commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7441

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone
  • Add pr to documentation list
  • Add automated tests
  • Add a reverse migration if a migration is present in the PR
  • Add migration function to
    def fix_schema_config(stdout: WriteToStdOut | None = None):

Testing instructions

Summary by CodeRabbit

  • Tests
    • Added coverage for the loan return workflow, including its dialogs, specimen display, and related data requests.

@CarolineDenis CarolineDenis added this to the 7.14.0 milestone Sep 30, 2026
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 749fdbec-7e3f-4921-9815-fde236a00ae8

📥 Commits

Reviewing files that changed from the base of the PR and between 75a371f and a65ded9.

📒 Files selected for processing (1)
  • specifyweb/frontend/js_src/lib/components/Interactions/__tests__/LoanReturn.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a test that opens a loan through Show Loans, selects Return Loan, and checks the rendered form controls and fetch calls.

Changes

Loan Return Form Test

Layer / File(s) Summary
Return form rendering and fetch assertions
specifyweb/frontend/js_src/lib/components/Interactions/__tests__/LoanReturn.test.tsx
The test mocks loan-related responses, opens Return Loan through Show Loans, and checks the Apply button, dialogs, Specimen cell, and fetch calls. It restores the current collection agent after the test.

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to a65de

This PR adds coverage for opening Return Loan through Show Loans. No actionable merge-blocking risk is established; it is mergeable subject to normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1 | ❓ 1

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Testing Instructions ⚠️ Warning The PR description has no testing instructions. Its Testing instructions section contains only the template comments. The PR adds LoanReturn.test.tsx, which covers ShowLoansCommand, opening a loan… Add clear instructions to run the focused frontend test from specifyweb/frontend/js_src, such as npm run unitTests -- lib/components/Interactions/__tests__/LoanReturn.test.tsx. State that the test must pass. Also describe the affected m…
Title check ❓ Inconclusive The title indicates that tests were added, but it does not identify the Loan Return behavior or the affected workflow. It is too generic to describe the main change clearly. Use a specific title such as "Tests: Cover Return Loan from Show Loans".
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR adds LoanReturn.test.tsx for issue [#7441]. The test opens a loan through ShowLoansCommand, clicks Return Loan, and verifies that the return workflow renders the Apply button and the loan…
Out of Scope Changes check ✅ Passed The only reviewed change adds a focused unit test for the [#7441] preparations workflow. The mocked responses and assertions support that workflow. No unrelated production or test changes are present …
Automatic Tests ✅ Passed The PR adds LoanReturn.test.tsx with a Jest test for the ShowLoansCommand to Return Loan workflow. Jest configuration includes **/__tests__/**/*.test.[jt]s?(x), so the test is automatically di…
Full details: Testing Instructions

Explanation

The PR description has no testing instructions. Its Testing instructions section contains only the template comments. The PR adds LoanReturn.test.tsx, which covers ShowLoansCommand, opening a loan from a Collection Object preparation, selecting Return Loan, and displaying the Loan Preparation return modal. The description does not identify this workflow, provide a test command, or state the expected result.

Resolution

Add clear instructions to run the focused frontend test from specifyweb/frontend/js_src, such as npm run unitTests -- lib/components/Interactions/__tests__/LoanReturn.test.tsx. State that the test must pass. Also describe the affected manual workflow: open a Collection Object with a loaned preparation, select Show Loans, open the loan, select Return Loan, and verify that the Loan Preparation return modal opens promptly and displays its Apply control and preparation details.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

Status: 📋Back Log

Development

Successfully merging this pull request may close these issues.

"Return Loan" is Unresponsive and Freezes System When Loan is Accessed via Preparations Form

1 participant