Skip to content

[Repo Assist] test: extend OperationCompiler unit tests (+12 tests)#380

Merged
sergey-tihon merged 3 commits intomasterfrom
repo-assist/test-operation-compiler-coverage-2026-04-15-282bc04ad06dc660
Apr 15, 2026
Merged

[Repo Assist] test: extend OperationCompiler unit tests (+12 tests)#380
sergey-tihon merged 3 commits intomasterfrom
repo-assist/test-operation-compiler-coverage-2026-04-15-282bc04ad06dc660

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Extends Schema.OperationCompilationTests.fs with 12 new unit tests covering three previously untested code paths in OperationCompiler.

Test count: 268 → 280

New Coverage

asAsync=true mode (4 tests)

The OperationCompiler has a asAsync: bool constructor parameter that switches return types from Task<T> to Async<T>. Before this PR there were zero unit tests exercising this path.

  • GET returning JSON string → Async<string> not Task<string>
  • POST with no body → Async<unit> not Task<unit>
  • Method name generation still works in async mode
  • CancellationToken is still injected last in async mode

DELETE / PUT operations (6 tests)

The existing tests only covered GET and POST. Added coverage for:

  • DELETE endpoint — generates method, returns Task<unit> on 204, path param ordering
  • PUT endpoint — generates method, path + body + CT ordering, Task<T> return when JSON response

Header parameters (2 tests)

  • Required header params are included as method parameters
  • Header parameter names are camelCased (X-Api-VersionxApiVersion)
  • Required header params are non-optional (IsOptional = false)

Test Status

dotnet build tests/SwaggerProvider.Tests/SwaggerProvider.Tests.fsproj -c Release  ✅
dotnet tests/SwaggerProvider.Tests/bin/Release/net10.0/SwaggerProvider.Tests.dll  ✅
Total: 280, Errors: 0, Failed: 0, Skipped: 1 (pre-existing)

Formatting validated with Fantomas.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

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

Add unit tests for three previously uncovered code paths:

- asAsync=true mode: verify Async<T> return types are emitted instead
  of Task<T> for all operation shapes
- DELETE/PUT operations: verify generated method names, parameter
  ordering, and return types (Task<unit> for 204, Task<T> for JSON
  response body)
- Header parameters: verify required header params are included as
  non-optional method parameters and are camelCased

Total: 268 → 280 tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon requested a review from Copilot April 15, 2026 19:49
@sergey-tihon sergey-tihon marked this pull request as ready for review April 15, 2026 19:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends Schema.OperationCompilationTests.fs with additional unit tests to cover previously untested OperationCompiler behaviors, including async (asAsync=true) return types, additional HTTP methods, and header-parameter handling.

Changes:

  • Add helper to compile schemas with asAsync=true and new assertions for Async<'T> return types.
  • Add DELETE and PUT operation compilation tests (method generation, parameter ordering, return type resolution).
  • Add header-parameter compilation tests (inclusion, camelCasing, required vs optional).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/SwaggerProvider.Tests/Schema.OperationCompilationTests.fs
Comment thread tests/SwaggerProvider.Tests/Schema.OperationCompilationTests.fs Outdated
@sergey-tihon
Copy link
Copy Markdown
Member

@copilot format, fix build and address inline commnets

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

@copilot format, fix build and address inline commnets

Done in e0bbd63. I fixed the inline review issue by updating the section header to match actual coverage (DELETE / PUT operations), then re-ran format/build/tests locally (CheckFormat, dotnet build tests/SwaggerProvider.Tests/..., and the test DLL), all passing.

Copilot AI requested a review from sergey-tihon April 15, 2026 19:59
@sergey-tihon sergey-tihon reopened this Apr 15, 2026
@sergey-tihon sergey-tihon merged commit 07af43b into master Apr 15, 2026
9 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/test-operation-compiler-coverage-2026-04-15-282bc04ad06dc660 branch April 15, 2026 20:08
github-actions Bot added a commit that referenced this pull request Apr 18, 2026
Capture the 9 PRs merged since beta01 (April 14 – April 18):
- fix: preserve properties+additionalProperties (#383)
- refactor: CallAsync returns HttpResponseMessage (#385)
- eng: remove stale YamlDotNet dependency (#386)
- test: +18 OperationCompiler tests (#380, #386)
- docs: README and VitePress site updates (#379, #382)
- ci: Dependabot action bumps (#387-#390)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sergey-tihon pushed a commit that referenced this pull request Apr 19, 2026
* docs: add 4.0.0-beta02 release notes entry

Capture the 9 PRs merged since beta01 (April 14 – April 18):
- fix: preserve properties+additionalProperties (#383)
- refactor: CallAsync returns HttpResponseMessage (#385)
- eng: remove stale YamlDotNet dependency (#386)
- test: +18 OperationCompiler tests (#380, #386)
- docs: README and VitePress site updates (#379, #382)
- ci: Dependabot action bumps (#387-#390)

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

* ci: trigger checks

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

3 participants