Skip to content

test: add regression coverage for @ApiClient code generation - #172

Open
FranciscoValerio wants to merge 2 commits into
Flutterando:mainfrom
FranciscoValerio:test/api-client-codegen-regression
Open

test: add regression coverage for @ApiClient code generation#172
FranciscoValerio wants to merge 2 commits into
Flutterando:mainfrom
FranciscoValerio:test/api-client-codegen-regression

Conversation

@FranciscoValerio

Copy link
Copy Markdown

📄 Description

Adds an automated regression test for @ApiClient() code generation
in vaden_class_scanner. The 0.1.4 -> 1.0.x refactor briefly dropped
support for @ApiClient() (issue #139), fixed in #144, but no test
was added to prevent this from regressing again.

🔄 Changes Made

  • Added test/fixtures/api_client_fixture.dart with an
    @ApiClient()-annotated abstract class.
  • Added test/api_client_generation_test.dart using
    build_test's testBuilder to assert the generated
    vaden_application.dart registers the class via its generated
    implementation, not the abstract constructor.
  • Added a second case covering the no-op path: the builder still
    succeeds and emits no @ApiClient boilerplate when the package
    has no @ApiClient classes, guarding the optional
    apiClientBuffer threading introduced in fix: @Scope and @ApiClient handling #144.
  • Added build_test as a dev_dependency of vaden_class_scanner.

✅ Checklist

  • Tests have been added or updated.
  • Documentation has been updated (if necessary).
  • Code review completed.

🔗 Related Issue

Relates to #139 (fixed by #144) — adds missing test coverage.

Adds a build_test-based regression test asserting that classes
annotated with @APIClient() are registered as lazy singletons via
their generated implementation (_X.new) instead of the abstract
constructor being torn off. Covers the scenario from Flutterando#139, fixed in
Flutterando#144, which currently has no automated test guarding against
regression.

Also adds build_test as a dev_dependency of vaden_class_scanner.
Extracts a shared builder-runner helper and adds a second case
asserting FlutterVadenBuilder still succeeds and emits no @APIClient
boilerplate when the package only has @dto classes, guarding the
apiClientBuffer threading added in Flutterando#144.
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.

1 participant