Repository navigation
Test the error text of the translated validation messages - #503
Open
alexluckett wants to merge 4 commits into
Open
alexluckett wants to merge 4 commits into
alexluckett wants to merge 4 commits into
Conversation
Both location fields set their own required message, so the fallback to the generic required message never ran outside the test subclass. The config now requires the message, and the fallback is removed.
validate() now always applies the translated message overrides. Some of those messages had no test that checked their text, because the tests for invalid values only checked that an error was present. These tests check the text for: - a value that is not in the autocomplete list - a date day or month that is not a number, or is too large to be one - an easting that is not a number, or is too large to be one - a latitude that is too large to be a number
Each component test file has a Validation table of inputs and the exact output of validate(). The error text tests now sit in those tables, so that each file has one place for its validation errors. The Autocomplete Validation table had no test function, so its case did not run. It now runs for both lists, with the component of each list.
A user who fills in only one part of the field gets an error for the missing part. No test checked the text of that error, for a required or an optional field.
|
This branch has not been deployed
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.



Proposed change
This adds tests for the error text of each validation error that a user can get from a component.
Errors that now have tests:
Location fields now must set their own required message. Both location fields already did this, so the fallback to the generic message ran only in the test subclass. The fallback is removed, and the test subclass sets a required message.
Jira ticket:
Type of change
Checklist
README.mdanddocs/*(where appropriate, e.g. new features).npm run test).npm run lint).npm run format).