fix: Flutter & Dart SDKs - all tests passing (405/405 unit, 138/138 cross-SDK)#7
Open
fix: Flutter & Dart SDKs - all tests passing (405/405 unit, 138/138 cross-SDK)#7
Conversation
… tests - Add optional httpClient parameter to DefaultHTTPClient for dependency injection - Rewrite tests to use Mockito mocks instead of real HTTP calls to jsonplaceholder.typicode.com - Add comprehensive test coverage for retry logic (502/503), error handling (4xx), and connection failures - Tests are now deterministic and don't depend on external services
- Add attrsSeq tracking to detect attribute changes after assignment - Add audienceMatches() method to check if audience match status changed - Clear assignment cache when audience mismatch status changes - Update example pubspec.lock
Add absmartly_dart.dart as the main entry point that exports all public APIs including SDK classes, configurations, providers, handlers, and JSON models.
- Copy all tests from Flutter SDK to dart_sdk package - Update imports from package:absmartly_sdk to package:absmartly_dart/src/ - Replace flutter_test with test package - Remove Flutter-specific bindings (WidgetsFlutterBinding) - Update test_utils.dart to use dart:io instead of Flutter's rootBundle - Copy test resources (JSON fixtures) for tests - Regenerate mockito mocks for new package structure - All 215 tests pass
Move the example Flutter app from the root example/ directory to packages/flutter_sdk/example/. Also simplify imports to use the single barrel file import instead of individual file imports.
Add declarative widgets for A/B testing in Flutter: - ABSmartlyProvider: InheritedWidget for context propagation - Treatment: Map-based variant rendering - TreatmentBuilder: Builder pattern with variables access - TreatmentSwitch/TreatmentVariant: Declarative child-based variants - LoadingBehavior: Configurable loading state handling All widgets support: - Custom loading widgets - Timeout-based fallback to control - Silent error handling (fallback to control on failure) - Optional custom context override Includes 62 passing tests covering all widget functionality.
- Add VariableValue widget export to flutter_sdk - Fix context assignment cache clearing on refresh - Remove duplicate unit handling in context - Enhance audience_matcher tests with comprehensive coverage
- Add Flutter widget integration tests - Add error recovery scenario tests - Add platform-specific edge case tests - Add performance tests - Add integration scenario tests Total: 130 new tests added, all 158 tests pass
Add 22 context tests covering refresh state preservation, exposure queuing after peek, variable value deduplication, close/publish error handling, post-close exceptions, and unknown experiment/variable handling. Fix 9 pre-existing refresh test failures caused by assignmentCache clearing.
…platform_test Context.peekTreatment throws StateError (not Exception) when the context is not ready. StateError extends Error, not Exception, so throwsException matcher was incorrect. This fix aligns the test with the actual error type. Result: 158/158 flutter_sdk unit tests passing, exit code 0.
…ility
- Change exceptions to ArgumentError/StateError for proper Dart semantics
- Fix track() to use properties parameter correctly (was always empty {})
- Fix getUnits() to return actual units (was returning empty map)
- Add attribute name validation
- Add catchError handlers for timer-based flush/refresh
- Update tests for new error types and behavior
Result: 247/247 dart_sdk unit tests passing, exit code 0.
138/138 cross-SDK tests passing.
|
Important Review skippedToo many files! This PR contains 221 files, which is 71 over the limit of 150. You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
Flutter SDK fix
platform_test.dartline 481:throwsException->throwsStateErrorContext.peekTreatmentthrowsStateError(extendsError), notException-- these are separate hierarchies in DartDart SDK fixes
ExceptiontoArgumentErrorfor unit validation errors (proper Dart semantics)ExceptiontoStateErrorfor context state errors (closed/closing/not ready)track()to use thepropertiesparameter correctly (was always passing empty{})getUnits()to return actual units map (was returning empty map)catchErrorhandlers for timer-basedflush()andrefresh()to prevent unhandled async errorsMonorepo restructure (included in this PR)
packages/dart_sdk(pure Dart) andpackages/flutter_sdk(Flutter widgets)Treatment,TreatmentBuilder,TreatmentSwitch,VariableValue,ABSmartlyProviderTest plan
dart testinpackages/dart_sdk-- 247/247 passed, exit code 0flutter testinpackages/flutter_sdk-- 158/158 passed, exit code 0