-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate WritingSystemIds on creation #1230
Conversation
Special ID "default" is allowed, all other writing system IDs must be considered valid by the SIL.WritingSystems validation logic.
Five failing unit tests when I run this locally:
The three FwLiteProjectSync tests are failing because AutoFaker.Generate() is generating randomly-named writing system IDs, and we're no longer allowing that. We'll need to teach Generate() to pick writing system IDs randomly from an allowable list. ... And the two LcmCrdt tests are failing for the same reason: there's an AutoFaker.Generate() call in there, which needs to be taught how to pick valid writing system IDs. Update: Same five tests are failing in GHA, for the same reason. |
Now when AutoFaker.Generate creates a random writing system ID, it will be chosen from the list of all valid 2-letter writing system IDs.
Commit 30bdc0f fixes the three FwLiteProjectSync tests. But interestingly, the two failing LcmCrdt tests are still generating writing systems that are randomly-chosen English words, rather than two-letter codes. Something in those tests isn't calling AutoFaker.Generate correctly... |
Commit 5d94a57 passes the MultiStringOverride to the two tests that were failing — but it's not being called correctly. So far I'm not sure why. |
Kevin has asked for some explicit unit tests around writing system ID validation, especially making sure that custom audio writing systems are going to validate. So I'm removing the review request, and I'll bring it back when those tests are written. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, I left a comment about reusing the language list from SIL.WritingSystems instead of hardcoding our own
Still some test failures, where AutoFaker.Generate is apparently generating strings (and therefore not using the WritingSystemIdOverride class), but those strings are actually writing system IDs and should have been chosen from the valid list.
# Conflicts: # backend/FwLite/FwLiteProjectSync.Tests/Fixtures/MultiStringOverride.cs # backend/FwLite/FwLiteProjectSync.Tests/UpdateDiffTests.cs # backend/FwLite/MiniLcm.Tests/AutoFakerHelpers/MultiStringOverride.cs # backend/FwLite/MiniLcm.Tests/FakerOverrids/MultiStringOverride.cs
Fix #984.
We now validate WritingSystemId records on creation and throw ArgumentException for any invalid writing system IDs. The special ID value "default" is allowed, all other writing system IDs must be considered valid by the SIL.WritingSystems validation logic.