[O2B-1602] Shared BeamTypesDto should return split input rather than simply validation - #2202
[O2B-1602] Shared BeamTypesDto should return split input rather than simply validation#2202graduta wants to merge 6 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2202 +/- ##
==========================================
- Coverage 46.20% 46.17% -0.03%
==========================================
Files 1039 1038 -1
Lines 17131 17121 -10
Branches 3123 3121 -2
==========================================
- Hits 7915 7906 -9
+ Misses 9216 9215 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| const Joi = require('joi'); | ||
| const { validateBeamTypes, BEAM_TYPE_INVALID } = require('../../../utilities/beamTypeUtils'); | ||
| const { CustomJoi } = require('../CustomJoi.js'); |
There was a problem hiding this comment.
I understand this was not introduced in this PR, so not to be implemented here, but would you agree that CustomJoi is a rather nondescript name and should be changed to something like `StringArrayJoi? If so, I will make a note and then the change.
| exports.BeamTypesDto = CustomJoi.stringArray() | ||
| .items(Joi.string() | ||
| .trim() | ||
| .min(2) |
There was a problem hiding this comment.
Is this minimum check necessary as the pattern enforces >2 chars with char dash char?
| .min(2) | ||
| .max(15) | ||
| .pattern(/^[A-Za-z0-9]+ ?- ?[A-Za-z0-9]+$/) | ||
| .messages({ |
There was a problem hiding this comment.
The custom validator was the only thing raising BEAM_TYPE_INVALID error so I believe this is now dead message handler code.
Supported by the fact the test/api/runs.test.js LN196 test has been changed to assert the default JOI message format.
Do you agree?
I have a JIRA ticket
Notable changes for users:
Notable changes for developers: