Skip to content

[repo-assist] Add unit tests for WidgetDiff.WidgetChanges diffing - #1316

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/test-widgetdiff-widgetchanges-23a4ca3ac08780d0
Draft

[repo-assist] Add unit tests for WidgetDiff.WidgetChanges diffing#1316
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/test-widgetdiff-widgetchanges-23a4ca3ac08780d0

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.

Summary

Adds unit tests for WidgetDiff.WidgetChanges — the diffing logic used for single-widget attributes (e.g. a container's Content), continuing the test-coverage work from prior Repo Assist PRs (#1311, #1312) that added tests for WidgetDiff.ScalarChanges and WidgetDiff.EnvironmentChanges. WidgetDiff.fs still lacked any coverage for the WidgetChanges enumerator prior to this PR.

New file: src/neutral/Fabulous.Tests/WidgetDiffWidgetChangesTests.fs

Covers:

  • Empty prev/next → no changes
  • All Added when prev is empty
  • All Removed when next is empty
  • Identical widget reference → no-op
  • Different widget + canReuseView returns trueUpdated
  • Different widget + canReuseView returns falseReplacedBy
  • Disjoint attribute key sets → one Removed + one Added

Since WidgetChange is a struct DU whose cases carry a Widget value, tests project results into a small private plain-data WidgetChangeKind DU (same pattern used in the earlier ScalarChanges/EnvironmentChanges test PRs) to keep assertions simple and independent of the Widget struct's #if DEBUG conditional field layout.

Rationale

Part of ongoing Task 10 (Take the Repository Forward) work: incrementally closing test-coverage gaps identified in WidgetDiff.fs. WidgetCollectionChanges/WidgetCollectionItemChanges (more involved, nested widget-list diffing) and Reconciler.fs remain as follow-up candidates for a future run.

Test Status

  • dotnet test src/neutral/Fabulous.Tests/Fabulous.Tests.fsproj -c Release: ✅ 49/49 passed (7 new tests added, was 42)
  • dotnet fantomas --check src/neutral/Fabulous.Tests: ✅ no formatting issues
  • Test-only change; no production code modified.

CHANGELOG.md updated under [Unreleased].

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • avbuildtelapiv1.avaloniaui.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "avbuildtelapiv1.avaloniaui.net"

See Network Configuration for more information.

Generated by 🌈 Repo Assist, see workflow run. Learn more.
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@ae8d551f07c7ed7619f8c58c7bb4c3ac89395d38

Sub.fs, StackArray3, WidgetDiff.ScalarChanges, and WidgetDiff.EnvironmentChanges
already have coverage from prior Repo Assist PRs. WidgetDiff.WidgetChanges (used
for diffing single-widget attributes such as a Page's Content) was still untested.

Added src/neutral/Fabulous.Tests/WidgetDiffWidgetChangesTests.fs covering: empty
prev/next, all-Added when prev empty, all-Removed when next empty, no-op on an
identical widget reference, Updated when canReuseView returns true for a changed
widget, ReplacedBy when canReuseView returns false, and disjoint attribute keys
(one Removed + one Added).

🤖 This is an automated change by Repo Assist, an AI assistant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MiroslavHustak

Copy link
Copy Markdown
Collaborator

I suggest holding off on reviewing/merging this PR until canary testing/QA across the repo completes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant