Repository navigation
test(config): add unit tests - #295
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DXXPnGepYUGie3we1X9PTR
claude
Bot
requested review from
BeerHobbyist,
Komoszek,
alszczep,
kamilgacan,
katarzynagrasewicz,
konowrockis and
kumalg
as code owners
June 25, 2026 09:35
Komoszek
reviewed
Jun 25, 2026
Comment on lines
+9
to
+14
| it("returns an object exposing getInjectedConfig", () => { | ||
| const result = mkGetInjectedConfig() | ||
|
|
||
| expect(result).toHaveProperty("getInjectedConfig") | ||
| expect(typeof result.getInjectedConfig).toBe("function") | ||
| }) |
Contributor
There was a problem hiding this comment.
Is this necessary? Isn't it enforced by typescript and other tests?
Author
There was a problem hiding this comment.
Masz rację — getInjectedConfig to typowany literał obiektu, więc TS już gwarantuje, że pole istnieje i jest funkcją. Dodatkowo każdy kolejny test destrukturyzuje i wywołuje ten getter, więc jego obecność i wywoływalność są pokryte runtime'owo. Usunąłem ten test.
The test only asserted the static object shape (getInjectedConfig exists and is a function), which TypeScript already guarantees from the typed object literal returned by mkGetInjectedConfig. It is also exercised at runtime by every other test that destructures and calls getInjectedConfig. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DXXPnGepYUGie3we1X9PTR
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.
Requested by Sebastian Konowrocki · Slack thread
Before / After
The
@leancodepl/configpackage had no tests. This adds 9 unit tests coveringmkGetInjectedConfig, the package's only public API:getInjectedConfigfunctionimport.meta.envusing theVITE_prefixundefinedfor unset variablesVITE_FOOBARvsFOO)How
Added
src/index.spec.tsusing vitest withvi.stubEnvto driveimport.meta.env, mirroring the sibling@leancodepl/loggertest conventions. Addedvitestto the package'sdevDependenciesso the spec import resolves under the lint rules.:test,:typecheck,:lint, and:buildall pass.Generated by Claude Code