[OSDEV-1781] SLC form. Add clear error messages for number of workers field.#553
Conversation
Dedupe Hub App | Unittest test suite - Code coverage reportTotal: 56.14%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Countries App | Unittest test suite - Code coverage reportTotal: 100%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Contricleaner App | Unittest test suite - Code coverage reportTotal: 98.91%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
React App | Jest test suite - Code coverage reportTotal: 33.03%Your code coverage diff: 0.15% ▴ ✅ All code changes are covered |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
doc/release/RELEASE-NOTES.md(1 hunks)src/react/src/__tests__/components/ProductionLocationInfo.test.js(4 hunks)src/react/src/__tests__/utils.tests.js(3 hunks)src/react/src/util/util.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- src/react/src/tests/components/ProductionLocationInfo.test.js
- src/react/src/tests/utils.tests.js
- doc/release/RELEASE-NOTES.md
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: run-integration-test-code-quality
- GitHub Check: run-flake8-linter
- GitHub Check: run-fe-code-quality
- GitHub Check: run-eslint-linter-and-prettier-formatter
- GitHub Check: run-django-code-quality
- GitHub Check: run-dd-code-quality
- GitHub Check: run-countries-code-quality
- GitHub Check: run-contricleaner-code-quality
- GitHub Check: get-base-branch-fe-cov
- GitHub Check: get-base-branch-dd-cov
- GitHub Check: get-base-branch-django-cov
- GitHub Check: get-base-branch-contricleaner-cov
- GitHub Check: get-base-branch-countries-cov
|
@Innavin369 Apply fixes from sonarqubecloud - link |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/react/src/__tests__/utils.tests.js (1)
2247-2274: Well-structured test suite for number of workers validation.Good job creating a separate test suite for the
getNumberOfWorkersValidationErrorfunction as requested in the previous review. The test cases are thorough and cover various validation scenarios including:
- Zero values
- Invalid ranges (min > max)
- Values with leading zeros
- Invalid formats
I also appreciate the integration test with
isValidNumberOfWorkersthat was requested.One small suggestion to improve readability:
- expect(!isValidNumberOfWorkers('100') && getNumberOfWorkersValidationError('100')).toBe(false); + // For valid input, isValidNumberOfWorkers should return true and we shouldn't need an error message + expect(isValidNumberOfWorkers('100')).toBe(true); + expect(!isValidNumberOfWorkers('0-300')).toBe(true); + expect(getNumberOfWorkersValidationError('0-300')).toBe(expectedValueOfZeroText);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/react/src/__tests__/utils.tests.js(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/react/src/__tests__/utils.tests.js (1)
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#553
File: src/react/src/util/util.js:1153-1189
Timestamp: 2025-03-13T13:11:50.164Z
Learning: The `getNumberOfWorkersValidationError` function in the Open Supply Hub project is designed to be called only after a value has been determined to be invalid, not for validation checking itself. It will always return an error message since it's only used on already-invalid inputs.
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: run-integration-test-code-quality
- GitHub Check: run-flake8-linter
- GitHub Check: run-fe-code-quality
- GitHub Check: run-eslint-linter-and-prettier-formatter
- GitHub Check: run-django-code-quality
- GitHub Check: run-dd-code-quality
- GitHub Check: run-countries-code-quality
- GitHub Check: run-contricleaner-code-quality
- GitHub Check: get-base-branch-django-cov
- GitHub Check: get-base-branch-fe-cov
- GitHub Check: get-base-branch-contricleaner-cov
- GitHub Check: get-base-branch-countries-cov
- GitHub Check: get-base-branch-dd-cov
🔇 Additional comments (1)
src/react/src/__tests__/utils.tests.js (1)
85-86: Improvement to validation utilities for "number of workers".The addition of these two new utility functions aligns well with the PR objective of adding clear error messages for the "number of workers" field in the SLC form and Claimed Facility Details page.
VadimKovalenkoSNF
left a comment
There was a problem hiding this comment.
Apply fixes from sonarqubecloud - link
|



OSDEV-1781 A clear error messages for the number of workers field has been added to the SLC form and Claimed Facility Details page.
Changes have been made on pages: