Skip to content

Serialize Dialog tests and fix reducibleMiddlewareToCancel condition polling#116

Merged
Maks-Jago merged 3 commits into
1.5.1from
fix/serialize-dialog-tests
Jun 1, 2026
Merged

Serialize Dialog tests and fix reducibleMiddlewareToCancel condition polling#116
Maks-Jago merged 3 commits into
1.5.1from
fix/serialize-dialog-tests

Conversation

@killlilwinters
Copy link
Copy Markdown
Collaborator

@killlilwinters killlilwinters commented Jun 1, 2026

Description

This merge request restructures dialog-related tests to run under a shared serialized test registry, addressing isolation issues caused by the global dialog registry state. The change is necessary because multiple dialog and toast tests rely on shared registration APIs (Dialog.register, DialogRegistry.registerToast, _DialogRegistry.get) and can interfere with each other if executed outside a coordinated serialized scope.

Instead of keeping several independent serialized suites, the tests are now grouped under a single DialogRegistryTests container. This makes registry-dependent behavior explicit and reduces flakiness from cross-test contamination. An alternative would have been to remove global/shared registry usage from the tests entirely, but this MR chooses the lighter-weight approach of reorganizing the suite boundaries.

It also tightens one middleware cancellation test by replacing polling-based assertions with direct state checks plus an explicit store synchronization step, making the test less timing-dependent.

Changes Made

  • Introduced a new top-level serialized test container:

    @Suite(.serialized)
    struct DialogRegistryTests {}
  • Moved existing dialog registry-related suites under that shared container:

    • DialogTests is now nested under DialogRegistryTests
    • ToastDismissCallbackTests is now nested under DialogRegistryTests
    • DialogDSLTests extension target was updated accordingly:
      extension DialogRegistryTests.DialogTests
  • Preserved dialog test setup that clears the registry on suite init, but now within the nested suite structure:

    init() {
        Dialog.clearAll()
    }
  • Consolidated all registry-dependent dialog/toast coverage under the same serialized execution scope, including:

    • legacy and DSL-based dialog registration
    • toast registration and presentation
    • custom toast icon/custom view behavior
    • toast auto-dismiss callback registration and execution behavior
    • registry lookup behavior for registered/unregistered IDs
  • Improved MiddlewareCancellationTests to avoid asynchronous polling when validating cancellation:

    • replaced waitForCondition for the initial loading assertion with direct state verification
    • added await store.wait() after dispatching cancel action
    • verified final state directly after synchronization
    await store.dispatch(Actions.CancelLoading())
    await store.wait()
    success = await store.state.middlewareFlow == .none

@killlilwinters killlilwinters added this to the 1.5.1 milestone Jun 1, 2026
@killlilwinters killlilwinters requested a review from Maks-Jago June 1, 2026 11:49
@killlilwinters killlilwinters added the bug Something isn't working label Jun 1, 2026
@Maks-Jago Maks-Jago merged commit 5cf31f3 into 1.5.1 Jun 1, 2026
1 check passed
@Maks-Jago Maks-Jago deleted the fix/serialize-dialog-tests branch June 1, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants