Skip to content

test: add unit tests for locale utility functions under the spec module#584

Merged
mathio merged 7 commits intolingodotdev:mainfrom
khalatevarun:feat/add-tests-local-specs
Mar 28, 2025
Merged

test: add unit tests for locale utility functions under the spec module#584
mathio merged 7 commits intolingodotdev:mainfrom
khalatevarun:feat/add-tests-local-specs

Conversation

@khalatevarun
Copy link
Copy Markdown
Contributor

fix: #563

Before

image

After

image

});

export const resolveLocaleCode = (value: LocaleCode): LocaleCodeFull => {
export const resolveLocaleCode = (value: string): LocaleCodeFull => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the function already handles case for an invalid code on line 239, we can make the input param type as string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! 🚀

@khalatevarun khalatevarun changed the title Add unit tests for locale utility functions under the spec module test: add unit tests for locale utility functions under the spec module Mar 26, 2025
Comment thread packages/spec/src/locales.spec.ts Outdated
expect(resolveOverridenLocale("enUS", "_")).toEqual("enUS");
expect(resolveOverridenLocale("frFR", "-")).toEqual("frFR");
});
}); No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe prettier adds an empty line to files. Please run prettier on all code you contribute. Thanks.

Comment thread .changeset/metal-bottles-travel.md Outdated
@@ -0,0 +1,5 @@
---
"@lingo.dev/_spec": major
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests are not a "major" change. Please make this a "patch".

Copy link
Copy Markdown
Contributor

@mathio mathio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments.

expect(resolveOverridenLocale("frFR", "-")).toEqual("frFR");
});
}); No newline at end of file
});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done @mathio

@@ -1,5 +1,5 @@
---
"@lingo.dev/_spec": major
"@lingo.dev/_spec": patch
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to patch

@khalatevarun khalatevarun requested a review from mathio March 26, 2025 18:15
Comment thread packages/spec/src/locales.spec.ts Outdated
@@ -1,5 +1,5 @@
import { describe, it, expect } from "vitest";
import { normalizeLocale } from "./locales";
import { getLocaleCodeDelimiter, normalizeLocale, resolveLocaleCode, resolveOverridenLocale } from "./locales";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khalatevarun the resolveOverridenLocale function was renamed in #576 to resolveOverriddenLocale. Once this is resolved we can merge it 🙌

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved, renamed the function

@mathio mathio merged commit 743d93e into lingodotdev:main Mar 28, 2025
2 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spec Module (/packages/spec): Add unit tests for locale utility functions

2 participants