Skip to content

unit-test: disable relationships for batch edit and enable rollback in user preferences - #8500

Open
kwhuber wants to merge 1 commit into
mainfrom
issue-8499
Open

unit-test: disable relationships for batch edit and enable rollback in user preferences#8500
kwhuber wants to merge 1 commit into
mainfrom
issue-8499

Conversation

@kwhuber

@kwhuber kwhuber commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #8499

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 automated test coverage for dataset variant behavior, including permission checks and user preference handling.
    • No user-facing functionality changes.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: a8c14eef-d245-4684-899e-5b78037e78d6

📥 Commits

Reviewing files that changed from the base of the PR and between 7cf79dc and ab97fee.

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

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


📝 Walkthrough

Walkthrough

The PR adds a new test file for datasetVariants. It imports permission and preference dependencies and mocks hasPermission with a typed Jest reference.

Changes

Dataset variants testing

Layer / File(s) Summary
Permission test setup
specifyweb/frontend/js_src/lib/components/WbUtils/__tests__/datasetVariants.test.ts
The new test imports hasPermission, userPreferences, and datasetVariants. It mocks hasPermission and creates a typed mock reference for assertions.

Merge Risk: ⚪ Minimal · up to ab97f

This change adds dataset-variant permission test scaffolding without modifying production behavior. No merge-readiness risk is currently identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Automatic Tests ⚠️ Warning The PR does not include an automatic test case. It adds only imports, a Jest mock, and a typed mock reference in datasetVariants.test.ts; it contains no test, it, or describe declaration and n… Add one or more executable Jest tests in datasetVariants.test.ts. Exercise the intended datasetVariants behavior, include assertions, and reset mock state between tests where needed.
Testing Instructions ⚠️ Warning The pull request has no testing instructions. The authored Testing instructions section contains only template comments, so it gives no verification steps for the new datasetVariants test or its `ha… Add concrete testing instructions. State that commands run from specifyweb/frontend/js_src, include the targeted command npm run unitTests -- lib/components/WbUtils/__tests__/datasetVariants.test.ts, and describe the expected assertions…
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies a unit-test change and references user preferences, which are present in the changeset. However, the changeset only adds a rough test setup and does not implement or verify disabl…
Full details: Automatic Tests

Explanation

The PR does not include an automatic test case. It adds only imports, a Jest mock, and a typed mock reference in datasetVariants.test.ts; it contains no test, it, or describe declaration and no assertions. Jest discovers this file because its path matches the repository testMatch pattern, so the file is an empty test suite. Automatic testing is necessary for this PR because its stated purpose is a unit-test sketch.

Full details: Testing Instructions

Explanation

The pull request has no testing instructions. The authored Testing instructions section contains only template comments, so it gives no verification steps for the new datasetVariants test or its hasPermission and userPreferences dependencies. The changed test currently contains imports and mock setup only; it has no describe, test, or it case to identify another verification path.

Resolution

Add concrete testing instructions. State that commands run from specifyweb/frontend/js_src, include the targeted command npm run unitTests -- lib/components/WbUtils/__tests__/datasetVariants.test.ts, and describe the expected assertions or manual checks for datasetVariants, permission handling, and preference handling. Update the instructions when the test cases are added.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8499

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.

@kwhuber kwhuber changed the title [test]: rough sketch of unit test unit-test: disable relationships for batch edit and enable rollback in user preferences Sep 4, 2026
@@ -0,0 +1,10 @@
import { hasPermission } from '../../Permissions/helpers';
import { userPreferences } from '../../Preferences/userPreferences';
@@ -0,0 +1,10 @@
import { hasPermission } from '../../Permissions/helpers';
import { userPreferences } from '../../Preferences/userPreferences';
import { datasetVariants } from '../datasetVariants';
hasPermission: jest.fn(),
}));

const mockedHasPermission = hasPermission as jest.Mock;
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.

write unit-test to disable relationships for batch edit and enable rollback in user preferences

2 participants