[repo-assist] test: add async IO.Stream and non-200 2xx response return-type tests (+3 tests, 465→468)#453
Conversation
…(+3 tests, 465→468) Three new unit tests covering previously untested code paths in OperationCompiler: 1. asAsync=true + application/octet-stream response → Async<IO.Stream> Exercises the async branch of the IO.Stream response path (OperationCompiler.fs line ~488: awaitTask responseStream). 2. 201-only JSON response (no 200 defined) → Task<string> Exercises the 2xx fallback in the okResponse selection logic (the Seq.tryFind for codes in [200,300) branch). 3. 201-only JSON response in async mode → Async<string> Combines the two above — async mode + non-200 2xx fallback. Total unit tests: 465 → 468. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Repo Assist here — following up on the CI failures. The integration test failures here are pre-existing on This appears to be a regression introduced by the This PR's unit tests (
Add this agentic workflows to your repoTo install this agentic workflow, run |
…60526-c18aac75af7cc1e6
There was a problem hiding this comment.
Pull request overview
Adds targeted unit tests to increase coverage of OperationCompiler return-type selection, specifically for async octet-stream responses and non-200 2xx success responses that include a JSON schema.
Changes:
- Add a test asserting
asAsync=true+application/octet-stream(string/binary) producesAsync<IO.Stream>. - Add tests asserting a schema with only a
201JSON response (no200) producesTask<string>andAsync<string>depending on mode.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Three new unit tests covering previously untested code paths in
OperationCompiler:asAsync=true+application/octet-streamresponse →Async<IO.Stream>OperationCompiler.fsasync IO.Stream branchTask<string>okResponse2xx-fallback selectionAsync<string>Why these matter
Async<IO.Stream>: TheasAsync=truebranch for octet-stream responses (| Some t when t = typeof<IO.Stream> -> <@ %(awaitTask responseStream) @>.Raw) had no unit-test coverage at all. Any regression there would be invisible.Non-200 2xx fallback:
OperationCompilerselects the successful response by checking "200" first, then any 2xx code, then "default". The 2xx-fallback path had no unit test for the case where the response has a schema (only the no-body 201/204 cases were covered).Test Status
All 468 tests pass (465 before → 468 after). Format check passes (
dotnet fantomas --check).