test: add unit tests for locale utility functions under the spec module#584
Merged
mathio merged 7 commits intolingodotdev:mainfrom Mar 28, 2025
Merged
Conversation
khalatevarun
commented
Mar 26, 2025
| }); | ||
|
|
||
| export const resolveLocaleCode = (value: LocaleCode): LocaleCodeFull => { | ||
| export const resolveLocaleCode = (value: string): LocaleCodeFull => { |
Contributor
Author
There was a problem hiding this comment.
since the function already handles case for an invalid code on line 239, we can make the input param type as string
mathio
reviewed
Mar 26, 2025
| expect(resolveOverridenLocale("enUS", "_")).toEqual("enUS"); | ||
| expect(resolveOverridenLocale("frFR", "-")).toEqual("frFR"); | ||
| }); | ||
| }); No newline at end of file |
Contributor
There was a problem hiding this comment.
I believe prettier adds an empty line to files. Please run prettier on all code you contribute. Thanks.
mathio
reviewed
Mar 26, 2025
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@lingo.dev/_spec": major | |||
Contributor
There was a problem hiding this comment.
Added tests are not a "major" change. Please make this a "patch".
khalatevarun
commented
Mar 26, 2025
| expect(resolveOverridenLocale("frFR", "-")).toEqual("frFR"); | ||
| }); | ||
| }); No newline at end of file | ||
| }); |
khalatevarun
commented
Mar 26, 2025
| @@ -1,5 +1,5 @@ | |||
| --- | |||
| "@lingo.dev/_spec": major | |||
| "@lingo.dev/_spec": patch | |||
Contributor
Author
There was a problem hiding this comment.
changed to patch
mathio
approved these changes
Mar 27, 2025
mathio
reviewed
Mar 27, 2025
| @@ -1,5 +1,5 @@ | |||
| import { describe, it, expect } from "vitest"; | |||
| import { normalizeLocale } from "./locales"; | |||
| import { getLocaleCodeDelimiter, normalizeLocale, resolveLocaleCode, resolveOverridenLocale } from "./locales"; | |||
Contributor
There was a problem hiding this comment.
@khalatevarun the resolveOverridenLocale function was renamed in #576 to resolveOverriddenLocale. Once this is resolved we can merge it 🙌
Contributor
Author
There was a problem hiding this comment.
resolved, renamed the function
mainstar123
pushed a commit
to mainstar123/lingo.dev
that referenced
this pull request
Jul 7, 2025
17prateek12
pushed a commit
to 17prateek12/lingo.dev
that referenced
this pull request
Jan 23, 2026
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.
fix: #563
Before
After