Registry Mirror
Skip to content

Conversation

@phmatray

@phmatray phmatray commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Implements #478.

Closes #478.

Executed the implementation plan task-by-task; each task's checkboxes are ticked on the issue and mirrored below. Ran a three-axis review (Standards / Spec / Verification) via read-only, isolated sub-agents and applied the one real finding before flipping ready.

Plan

  • Task 1: Replace tautological assertions in BoolFieldRendererTests
  • Task 2: Replace tautological assertions in DateTimeFieldRendererTests
  • Task 3: Replace tautological assertions in DecimalFieldRendererTests
  • Task 4: Replace tautological assertions in DoubleFieldRendererTests
  • Task 5: Replace tautological assertions in IntFieldRendererTests
  • Task 6: Replace tautological assertions in StringFieldRendererTests
  • Task 7: Replace tautological assertions in FileUploadFieldRendererTests
  • Task 8: Full suite validation (2112 tests green on the dev-synced tree, format gate clean)

Fixed along the way

  • fix: address code-review findings — IntFieldRendererTests.Render_Should_Handle_Boolean_As_Numeric_Value asserted only that a value attribute was present for a bool CurrentValue, not that it carried no literal text (the comment's own claim); added GetAttribute("value").ShouldBeNullOrEmpty() to actually verify it.

Follow-ups

  • FileUploadFieldRendererTests.cs: Render_WithMultipleFilesConfiguration_ConfiguresForMultipleUpload keeps a pre-existing uploadConfig.Multiple.ShouldBeTrue() assertion that checks the Arrange-time config object, not the rendered DOM; Render_ClearsValidationErrors_OnSuccessfulUpload keeps a pre-existing additionalAttributes.ShouldNotContainKey("FileUploadErrors") check on a dictionary the renderer never touches. Neither was a ShouldNotBeNull() call, so both were out of this issue's explicit scope (test(core): replace tautological renderFragment.ShouldNotBeNull() assertions with real DOM facts #478 targets only the ~140 ShouldNotBeNull() assertions) — worth a follow-up test-quality pass.
  • Several tests now accurately document renderer behaviour that contradicts their own name (e.g. Render_WithCurrentValueAsList_HandlesMultipleFiles asserts multiple is absent because ActualFieldType isn't stubbed in that test). Renaming was explicitly out of scope here (the issue's Spec requires "maintain existing test structure and naming"), so this is left for a future pass.

Review recap

  • Standards — 1 real finding (fixed above), 2 findings refuted (a claimed FakeItEasy-default bug in the Placeholder assertions; empirically verified via an actual test run that unconfigured string properties on these fakes default to "", not null — independently corroborated by the Verification-axis pass), 1 dismissed (helper-extraction suggestion; matches this repo's own repetitive per-[Fact] test style).
  • Spec — clean. AC1 (all ~140 ShouldNotBeNull() replaced) and the seam requirement (assertions go through the rendered DOM, never private state) both confirmed. AC3 (suites pass) confirmed by an actual dotnet test run, not just review. One accepted, necessary deviation: a few tests extract a single DateTime.Today/attribute value into a local so Arrange and the assertion compare the identical value, which is required for the assertion to be valid rather than scope creep.
  • Verification — no new tautological or gap-introducing assertions; every new assertion targets the rendered DOM and was cross-checked against the actual renderer source. The two pre-existing non-DOM assertions above were the only gaps found, both deferred per the scope note.

@phmatray
phmatray marked this pull request as ready for review September 24, 2026 09:21
@phmatray
phmatray merged commit db84cb0 into dev Sep 24, 2026
3 checks passed
@phmatray
phmatray deleted the test/478-replace-tautological-shouldnotbenull-assertions branch September 24, 2026 09:24
phmatray added a commit that referenced this pull request Sep 24, 2026
…#483) (#489)

* fix(core): resolve DisabledCondition in the core stub field renderers

The seven core stub renderers under FormCraft/Forms/Rendering/ read
Context.Field.IsDisabled directly, so .DisabledWhen(...) had no effect on the
no-adapter-registered fallback path even though FieldComponentBase.IsDisabled
already resolves it correctly for both UI adapters (#479).

Apply the same expression here:
Context.Field.DisabledCondition?.Invoke(Context.Model) ?? Context.Field.IsDisabled

Also stub IFieldConfiguration.DisabledCondition to null in the existing
Fake-based test helpers across these seven test files: FakeItEasy returns a
dummy Func<TModel,bool> (not null) for an unconfigured delegate property, and
invoking it returns false, which was silently overriding an explicitly
stubbed IsDisabled=true once the renderers started reading DisabledCondition
first.

Closes #483

* test(core): replace internal-state assertions with rendered-DOM checks

FileUploadFieldRendererTests had two pre-existing assertions that checked
internal state rather than rendered output (out of scope for #478/#486,
which targeted ShouldNotBeNull()):

- Render_WithMultipleFilesConfiguration_ConfiguresForMultipleUpload asserted
  uploadConfig.Multiple.ShouldBeTrue() — an Arrange-time fact about the config
  object, not the rendered DOM. Replaced with a DOM assertion that "accept"
  stays absent, consistent with the sibling tests' documented fact that this
  stub never reads FileUploadConfiguration.
- Render_ClearsValidationErrors_OnSuccessfulUpload asserted
  additionalAttributes.ShouldNotContainKey("FileUploadErrors") against a dict
  the renderer never touches. Replaced with a DOM assertion that "multiple"
  stays absent, matching the same fixed-markup fact already established in
  the file's other CurrentValue-driven tests.

Closes #488

* fix: address code-review findings

- FileUploadFieldRendererTests: give the two rendered-DOM replacement
  assertions (#488) something real to pin instead of proving "nothing is
  emitted from nothing" — set AcceptedFileTypes on the FileUploadConfiguration
  the "accept" assertion checks against, and stub ActualFieldType so the
  "multiple" assertion actually reflects a single-file scenario.
- CoreRendererDisabledWhenTests: assert the file-upload facts render an
  <input type="file"> in addition to the disabled state, so a future
  regression that accidentally resolved a different renderer for the field
  would be caught rather than silently asserting on the wrong element.
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.

test(core): replace tautological renderFragment.ShouldNotBeNull() assertions with real DOM facts

1 participant