Sync cross-field validation in IP form#4493
Open
zaelgohary wants to merge 2 commits intodevelopmentfrom
Open
Conversation
…IPRange in try-catch to handle any remaining errors gracefully, add unit tests
AhmedHanafy725
requested changes
Dec 7, 2025
Contributor
AhmedHanafy725
left a comment
There was a problem hiding this comment.
Please add how to run these tests
| })); | ||
|
|
||
| describe("Add IP Range Validation", () => { | ||
| // Replicate the validateIPRange function logic for testing |
Contributor
There was a problem hiding this comment.
Replicating the code wouldn't find any issues if the methods used to validate the IPs changed.
| vi.mocked(CidrTools.containsCidr).mockImplementation(() => { | ||
| throw new Error("Invalid CIDR"); | ||
| }); | ||
| const result = gatewayCheck("192.168.1.254", "192.168.1.1/24", undefined, IPType.single); |
Contributor
There was a problem hiding this comment.
192.168.1.254 is in range of 192.168.1.1/24, why it should fail?
Contributor
Author
From playground path, run |
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.
Sync cross-field validation, return early on any invalid IP, wrap getIPRange in try-catch to handle any remaining errors gracefully, and add unit tests
#4492