Skip to content

Fix Unit Tests & Introduce AST Based Validation - #49

Merged
FilledStacks merged 4 commits into
betafrom
bugfix/fix-unit-test
Aug 6, 2025
Merged

Fix Unit Tests & Introduce AST Based Validation#49
FilledStacks merged 4 commits into
betafrom
bugfix/fix-unit-test

Conversation

@Eimen2018

@Eimen2018 Eimen2018 commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

Overview

This PR enhances the router extension builder to support nested route naming and improves test infrastructure with AST (Abstract Syntax Tree) based validation for better reliability.

Key Changes

Router Enhancement

  • Nested Route Support: Router extension methods now generate proper names for nested routes with parent class context
  • Method Naming: Routes with parent classes generate methods like navigateToNestedViewInParentClass instead of generic navigateToView

Form Generator Updates

  • API Consistency: Updated extension naming from FormViewModel to FormStateHelper for consistency
  • Validation Logic: Improved form validation message handling and data update mechanisms
  • Code Quality: Cleaned up setter methods and validation logic formatting

Test Infrastructure Overhaul

  • AST-based Validation: Replaced brittle string comparison tests with Abstract Syntax Tree based validation ( Initial Implementation )
  • Structural Testing: New RouterAstValidator provides semantic code structure validation instead of format-dependent comparisons
  • Test Reliability: Eliminated flaky isolate-based tests that were causing CI issues
  • Better Error Messages: More descriptive test failure messages with clear validation criteria

Breaking Changes

None. All changes are backward compatible.

Migration Notes

No migration required. This is an enhancement that improves existing functionality without changing public APIs.

Screenshot 2025-08-06 at 02 57 01

@FilledStacks FilledStacks left a comment

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.

This is fucking dope dude!

The test stability will help a lot. Thanks for putting in the effort to fix that up.

@FilledStacks
FilledStacks merged commit e20f20b into beta Aug 6, 2025
1 check failed
@FilledStacks
FilledStacks deleted the bugfix/fix-unit-test branch August 6, 2025 11:31
FilledStacks added a commit that referenced this pull request Aug 7, 2025
* chore(deps): upgrade logger to 2.0.1 (#18)

BREAKING CHANGE

* upgrade logger to 2.0.1
* exchange pretty printer default values
* adjust unit tests for logger
* remove warnings

---------

Co-authored-by: Fernando Ferrara <ferrarafer@gmail.com>

* fix: update SDK constraints

* refactor: migrate to analyzer element2 API and update dependencies (#48)

- Updated imports from `element.dart` to `element2.dart` across multiple files to utilize the new API.
- Refactored parameter handling in various generator classes to accommodate changes in the element API.
- Enhanced logging functionality with improved PrettyPrinter integration.
- Removed redundant comments and improved code formatting for better readability.
- Updated pubspec.yaml to reflect new dependency versions and SDK constraints.
- Modified test cases to ensure compatibility with async operations.

* Fix Unit Tests & Introduce AST Based Validation (#49)

* Adds support for nested route naming with parent class context

* refactor: update form view model extensions and improve validation logic

* test: implement AST-based validation for router class generation

* fix: remove unnecessary formatting fix command and ensure newline at end of file in tests

---------

Co-authored-by: Sebastian Büchler <42775578+sebastianbuechler@users.noreply.github.com>
Co-authored-by: Fernando Ferrara <ferrarafer@gmail.com>
Co-authored-by: Aymen Nurhussen <37356773+Eimen2018@users.noreply.github.com>
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.

2 participants