-
-
Notifications
You must be signed in to change notification settings - Fork 974
test(locale): check for duplicated entries #1137
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
Conversation
I expect the test pipeline to fail for demonstration purposes. @ST-DDT would you have a look at the implementation and the error log in general? I trust in you and your abilities on such things. |
The implementation looks good, maybe you could use this expectation: expect(
uniqueDuplication,
`Found duplicate entries: [${uniqueDuplication
.sort()
.join(', ')}]`
).toBe([]);
// The sort should probably be outside of the string template The toBe check focuses more on the content of the array than the length. What do you think? (PS: We have to check if there are/should be exceptions to this rule) |
So I need to change about 1,4k locale files since they contain duplicates. Is it reasonable to fix all of this in one (THIS) PR? My current workflow is:
My question: Should I provide an additional PR where I sort ALL locale files alphabetically first. This could be much clearer for the git history. I use the |
@xDivisionByZerox yes, for me that sounds more safe
That way we have a better commit history in main branch |
Co-authored-by: ST-DDT <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1137 +/- ##
==========================================
- Coverage 99.63% 99.61% -0.02%
==========================================
Files 2165 2165
Lines 241432 237194 -4238
Branches 1021 1017 -4
==========================================
- Hits 240549 236287 -4262
- Misses 862 886 +24
Partials 21 21
|
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.
The check itself looks good, but duplicated. You might want to want to move the "describe if array ..." block into a helper method allowing recursive calls to it.
I could provide a patch/diff, if my explanation isn't easy to understand.
It looks like this PR doesn't really reduce the line count: |
Oh damn. Good catch. I will revert those files. I guess they slipped through as I played with the |
…faker-js/faker into test/locales/duplicated-entries
Those "additions" should be reverted now. They happened due to those files being implemented in a dynamic/logical way, not with a static data set. |
@xDivisionByZerox I found a way to simplify the test a bit, feel free to merge: diff |
@xDivisionByZerox Did you see my comment here: #1137 (comment) |
This PR will introduce a test that checks every
LocaleDefinition
for duplicated entries.The most important file that needs review is
test/locales.spec.ts
. Everything else are just changes that are required by this test case.