#8186 - No error if preset loaded to the library with empty <groupClass> provided#10086
Closed
mariam-khutuashvili wants to merge 1 commit into
Closed
Conversation
Contributor
|
Reviewed via /review-pr (code-quality, performance, documentation, security). Overall: Small, well-scoped change. Consistent with the surrounding name-validation patterns, constant lives next to its peers in One noteworthy item on the validation block itself — see inline. Everything else is either a stylistic nit (the two new tests could be a single |
ac86cbd to
a14f25a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds validation in Editor.updateMonomersLibrary to reject monomer group templates with an empty (or whitespace-only) class.
Previously silently dropped downstream by the consumer-side filter; now logs an error and skips the offending template while continuing to load the rest.
Spec
Changes
packages/ketcher-core/src/utilities/monomers.ts — new exported constant MONOMER_GROUP_TEMPLATE_CLASS_EMPTY_ERROR_MESSAGE.
packages/ketcher-core/src/application/editor/Editor.ts — new validation in the monomer group template loop, after the existing name-length check. Imports the new error message constant. Fires only when class is defined and trims to an empty string, so missing class (undefined) falls through to its own dedicated ticket.
packages/ketcher-core/tests/application/editor/Editor.test.ts — two new unit tests:
Tests reference the exported error message constant.
Check list
#1234 – issue name