Skip to content

[test]: Unit test for bulk carry forward config validation#8319

Open
rijulpoudel wants to merge 7 commits into
mainfrom
issue-8318
Open

[test]: Unit test for bulk carry forward config validation#8319
rijulpoudel wants to merge 7 commits into
mainfrom
issue-8318

Conversation

@rijulpoudel

@rijulpoudel rijulpoudel commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Fixes #8318

Summary by CodeRabbit

  • Tests
    • Added coverage for bulk-cloning validation across supported and unsupported table types.
    • Added test cases confirming that fields with incompatible formatting rules are correctly rejected for automatic numbering.
    • Ensured test mocks are restored after each scenario.

@github-actions

Copy link
Copy Markdown

Warning

One or more dependencies are approaching or past End-of-Life.
Please plan upgrades accordingly.

STATUS=WARNING
NODE_VERSION=20
NODE_CYCLE=20
EOL_DATE=2026-04-30
DAYS_REMAINING=-77

--- Node.js ---
Version: 20
EOL: 2026-04-30
Status: WARNING

STATUS=OK
PYTHON_VERSION=3.12
PYTHON_CYCLE=3.12
EOL_DATE=2028-10-31
DAYS_REMAINING=838

--- Python ---
Version: 3.12
EOL: 2028-10-31
Status: OK

STATUS=WARNING
DJANGO_VERSION=4.2
DJANGO_CYCLE=4.2
EOL_DATE=2026-04-07
DAYS_REMAINING=-100

--- Django ---
Version: 4.2
EOL: 2026-04-07
Status: WARNING


@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@rijulpoudel, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8811823b-6326-4c5b-98f9-53d744b26593

📥 Commits

Reviewing files that changed from the base of the PR and between 930ec83 and b2d8479.

📒 Files selected for processing (1)
  • specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts
📝 Walkthrough

Walkthrough

Changes

Bulk clone validation

Layer / File(s) Summary
Bulk clone configuration tests
specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts
Adds unit coverage for tableValidForBulkClone, including valid and invalid tables, unsupported formatter parts, test context setup, and mock restoration.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Testing Instructions ⚠️ Warning The PR description only says “Fixes #8318”; it gives no testing steps, so the testing instructions aren’t clear, even though the new tests target tableValidForBulkClone. Add a short testing section with exact steps/commands for CarryForward.test.ts, covering CollectionObject/Locality and regex/alpha/alphanumeric/numeric formatter cases.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR’s main change: adding unit tests for bulk carry forward config validation.
Linked Issues check ✅ Passed The changes cover the requested tableValidForBulkClone cases for valid tables and formatter-part rejection paths.
Out of Scope Changes check ✅ Passed The PR appears scoped to the requested unit tests and does not introduce unrelated code changes.
Automatic Tests ✅ Passed The PR adds unit tests for tableValidForBulkClone in CarryForward.test.ts, covering the requested valid and invalid cases.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8318

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts (1)

17-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use afterEach for cleaning up mocks.

Calling jest.restoreAllMocks() at the end of a test means that if the expect assertion fails, the mock won't be restored, potentially polluting subsequent tests. Consider extracting jest.restoreAllMocks() into an afterEach block.

  • specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts#L17-L25: Remove inline jest.restoreAllMocks() and add an afterEach block at the suite level.
  • specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts#L27-L35: Remove inline jest.restoreAllMocks().
  • specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts#L37-L45: Remove inline jest.restoreAllMocks().
  • specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts#L47-L55: Remove inline jest.restoreAllMocks().
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts`
around lines 17 - 25, Move mock cleanup to a suite-level afterEach for the tests
in
specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts:17-25,
removing the inline jest.restoreAllMocks() there. Also remove the inline cleanup
from
specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts:27-35,
37-45, and 47-55; the shared afterEach should restore mocks for all tests,
including when assertions fail.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts`:
- Around line 17-25: Move mock cleanup to a suite-level afterEach for the tests
in
specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts:17-25,
removing the inline jest.restoreAllMocks() there. Also remove the inline cleanup
from
specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts:27-35,
37-45, and 47-55; the shared afterEach should restore mocks for all tests,
including when assertions fail.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6974bebd-e4f2-4868-9e90-2ae0fa8ccc96

📥 Commits

Reviewing files that changed from the base of the PR and between bc644bc and 930ec83.

📒 Files selected for processing (1)
  • specifyweb/frontend/js_src/lib/components/FormMeta/__tests__/CarryForward.test.ts

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]: Unit test for bulk carry forward config validation

2 participants