Skip to content

Upgrade bUnit to v2 and complete the test context migration#87

Merged
danielchalmers merged 5 commits into
mainfrom
copilot/upgrade-bunit-to-v2-one-more-time
May 7, 2026
Merged

Upgrade bUnit to v2 and complete the test context migration#87
danielchalmers merged 5 commits into
mainfrom
copilot/upgrade-bunit-to-v2-one-more-time

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 7, 2026

The test suite was still on bUnit 1.x and relied on APIs that are obsolete in bUnit 2.x. This updates the suite to the current bUnit surface and finishes the migration by replacing the hidden DisposeAsync() shim with a proper async disposal pattern in the shared test context.

  • Dependency update

    • Bumped bunit from 1.40.0 to 2.7.2
  • bUnit API migration

    • Swapped TestContext usage to BunitContext
    • Replaced obsolete RenderComponent<T>() calls with canonical Render<T>()
    • Updated component disposal in tests to the v2 async model
  • Shared test context cleanup

    • Removed the hidden public new DisposeAsync()
    • Implemented IAsyncLifetime.DisposeAsync() explicitly
    • Moved local teardown into a protected virtual helper so derived test contexts can extend disposal without shadowing bUnit lifecycle members
    • Kept SQLite connection cleanup and bUnit context disposal in one path
  • Test alignment

    • Adjusted a small set of test expectations/fixtures to match current import flow behavior and keep the suite deterministic under the migrated setup
public abstract class JaTestContext : BunitContext, IAsyncLifetime
{
    Task IAsyncLifetime.DisposeAsync() => DisposeTestContextAsync();

    protected virtual async Task DisposeTestContextAsync()
    {
        if (_dbConnection != null)
        {
            await _dbConnection.CloseAsync();
            await _dbConnection.DisposeAsync();
            _dbConnection = null;
        }

        await base.DisposeAsync();
    }
}

Copilot AI and others added 5 commits May 7, 2026 15:30
Agent-Logs-Url: https://github.com/danielchalmers/JournalApp/sessions/16eea263-70d0-438d-98e4-aad1d78cfede

Co-authored-by: danielchalmers <7112040+danielchalmers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/danielchalmers/JournalApp/sessions/16eea263-70d0-438d-98e4-aad1d78cfede

Co-authored-by: danielchalmers <7112040+danielchalmers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/danielchalmers/JournalApp/sessions/16eea263-70d0-438d-98e4-aad1d78cfede

Co-authored-by: danielchalmers <7112040+danielchalmers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/danielchalmers/JournalApp/sessions/16eea263-70d0-438d-98e4-aad1d78cfede

Co-authored-by: danielchalmers <7112040+danielchalmers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/danielchalmers/JournalApp/sessions/ca8ad4e2-04e0-4113-811f-10663a20656e

Co-authored-by: danielchalmers <7112040+danielchalmers@users.noreply.github.com>
@danielchalmers danielchalmers marked this pull request as ready for review May 7, 2026 16:02
@danielchalmers danielchalmers merged commit 7a017c5 into main May 7, 2026
1 check passed
@danielchalmers danielchalmers deleted the copilot/upgrade-bunit-to-v2-one-more-time branch May 7, 2026 16:17
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