Skip to content

Update test assertions for struct nullability and target framework#1142

Merged
christianhelle merged 1 commit into
mainfrom
fix-failing-tests
Jun 14, 2026
Merged

Update test assertions for struct nullability and target framework#1142
christianhelle merged 1 commit into
mainfrom
fix-failing-tests

Conversation

@christianhelle

@christianhelle christianhelle commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Fixes

  1. Struct nullability test (NormalizeSwagger2OptionalReferencePropertyNullability_Incorrectly_Removes_Nullability_From_Struct_Value_Types): Updated assertion for DateTime to match actual buggy behavior. DateTime is parsed as IdentifierNameSyntax (not PredefinedTypeSyntax), so the normalizer also strips ? from it — same bug as custom structs.

  2. Polymorphism runtime proof (GenerateJsonSerializerContextPolymorphismTests): Changed target framework from net8.0 to net10.0 to match the available .NET runtime.

Verification

  • All 2095 tests pass
  • All 25 source generator tests pass

Summary by CodeRabbit

  • Tests
    • Updated test expectations for nullable value type handling in code generation.
    • Added .NET 10.0 support to test runtime verification suite.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Two test-only fixes: the expected generated property in the Swagger 2 optional-reference-property nullability regression test is updated from DateTime? to DateTime, and the embedded MSBuild runtime proof project in the JSON serializer context polymorphism test is updated to target net10.0 instead of net8.0.

Changes

Test Maintenance

Layer / File(s) Summary
Nullability assertion correction and net10.0 target framework bump
src/Refitter.Tests/Regression/RefitGeneratorAdvancedTests.cs, src/Refitter.Tests/Scenarios/GenerateJsonSerializerContextPolymorphismTests.cs
Expected generated member changed from DateTime? to DateTime in the struct nullability regression test; MSBuild TargetFramework in the polymorphism proof project updated from net8.0 to net10.0.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • christianhelle/refitter#1111: Updates the same embedded runtime proof project for Refit v11 compatibility, overlapping with the net10.0 target framework change in GenerateJsonSerializerContextPolymorphismTests.cs.
  • christianhelle/refitter#1067: Introduced the serializer-context and Swagger 2 nullable-generation scenarios that the two test assertions in this PR are correcting.

Suggested labels

bugfix, .NET

🐇 A struct lost its question mark one day,
And net8 was told to step away.
DateTime stands firm, no ? in sight,
net10 takes the stage — the future's bright!
The rabbit hops on, all tests set right. 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the two main changes: updating test assertions for struct nullability behavior and updating a target framework version.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-failing-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.31%. Comparing base (4f65ae4) to head (ba19ac9).
⚠️ Report is 28 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1142      +/-   ##
==========================================
- Coverage   94.57%   94.31%   -0.26%     
==========================================
  Files          38       48      +10     
  Lines        2597     2796     +199     
==========================================
+ Hits         2456     2637     +181     
- Misses         44       53       +9     
- Partials       97      106       +9     
Flag Coverage Δ
unittests 94.31% <ø> (-0.26%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@christianhelle christianhelle changed the title fix: update test assertions for struct nullability and target framework Update test assertions for struct nullability and target framework Jun 14, 2026
@christianhelle christianhelle merged commit 2825265 into main Jun 14, 2026
13 of 14 checks passed
@christianhelle christianhelle deleted the fix-failing-tests branch June 14, 2026 18:16
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.

1 participant