Repository navigation
test(cyberware-contract-generator-dart): add unit tests - #291
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
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/cyberware-contract-generator-dartpackage had no tests. It now has 25 tests across three files covering:config.spec.ts— the Zod config schema: accepts a valid{ schema, outputDir }, rejects a missing/non-stringoutputDir, strips unknown keys, and throws on.parseof an invalid config.loadConfig.spec.ts—resolveOutputDir(absolute paths returned unchanged, relative and parent-relative paths resolved against the config dir) andloadConfig(loads an explicit config path, preserves absoluteoutputDir, throws on a missing config file, throws on schema-validation failure).generate.spec.ts— the end-to-end Dart generation: writes exactly the three expected files (contract.dart,types.dart,connect_to_host.dart), creates the output dir when missing, reuses an existing one, prints the generation message, and asserts the real rendered Dart output — params extension types with pascal-cased section prefixes,Resulttypedefs (String vs void),RemoteParamsgetters, the abstractRemoteMethodsBasesignatures,promiseValue/toJSwiring for value-returning remote methods, theJSHostMethodsexternal methods, theconnectToHosthelper, the do-not-edit banner, and the "not a valid contract root" error path.How
Tests build real contract schemas with
mkZodContractSchema/methodDeffrom@leancodepl/cyberware-contract, generate into temp dirs, and assert the actual generated Dart source.Generated by Claude Code