Skip to content

Conversation

@MelbourneDeveloper
Copy link
Owner

TLDR;

Adds tests to specifically target and eliminate surviving mutations identified during mutation testing (https://dartmutant.dev) of the reflux library, focusing on selectors, store subscriptions, time travel enhancer, and composed enhancers.

What Does This Do?

This pull request enhances the robustness of the reflux library by adding targeted tests that specifically address mutations that survived the initial mutation testing process. These tests ensure that the core functionalities of reflux, such as selectors, store subscriptions, time travel, and enhancer composition, behave as expected under various edge cases and input conditions, thereby improving the overall reliability and correctness of the library.

Brief Details?

  • Adds a new test file, mutation_killer_test.dart, which includes focused tests for specific mutations across different components.
  • Expands the test suite in selector_memoization_test.dart to include tests for null input handling in selectors, addressing scenarios where initial caching might lead to incorrect results.
  • Modifies existing tests in selectors_test.dart and store_test.dart to improve coverage and address potential mutation issues.
  • Minor adjustments to store_edge_cases_test.dart

How Do The Tests Prove The Change Works?

The tests in mutation_killer_test.dart are designed to directly target and kill specific mutations:

  • Tests for createSelector3, createSelector4, createSelector5, ResettableSelector.create1, and ResettableSelector.create2 ensure correct computation even when initial inputs are null, preventing unintended caching of null results.
  • Tests for Store ensure that double unsubscriptions do not inadvertently remove other listeners and that the isSubscribed flag is correctly managed.
  • Tests for TimeTravelEnhancer verify correct history truncation and state management when jumping between states.
  • Tests for composeEnhancers confirm that enhancers are composed and applied correctly, even with empty or single enhancer lists.

The tests in selector_memoization_test.dart further validate correct selector behavior with null inputs and after cache resets.

@MelbourneDeveloper MelbourneDeveloper merged commit 4b9d538 into main Dec 24, 2025
1 check passed
@MelbourneDeveloper MelbourneDeveloper deleted the reflux branch December 24, 2025 20:59
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