Improve test coverage to ~100% for @azure-rest/core-client#38177
Merged
deyaaeldeen merged 17 commits intomainfrom Apr 21, 2026
Merged
Improve test coverage to ~100% for @azure-rest/core-client#38177deyaaeldeen merged 17 commits intomainfrom
deyaaeldeen merged 17 commits intomainfrom
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR increases test coverage for @azure-rest/core-client by adding/expanding internal Vitest specs to exercise previously uncovered helpers and request-method wrappers.
Changes:
- Added new internal tests for
operationOptionsToRequestParameters. - Added a new internal test for
keyCredentialAuthenticationPolicy. - Extended
getClienttests to validate all supported HTTP verb helpers (post,put,patch,delete,head,options,trace). - Extended
clientHelperstests to covergetCachedDefaultHttpsClientcaching behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdk/core/core-client-rest/test/internal/operationOptionHelpers.spec.ts | New tests for operation options → request parameters conversion (empty + abortSignal). |
| sdk/core/core-client-rest/test/internal/keyCredentialAuthenticationPolicy.spec.ts | New test validating API key header injection behavior for the policy. |
| sdk/core/core-client-rest/test/internal/getClient.spec.ts | Adds coverage for non-GET HTTP method helpers to ensure correct PipelineRequest.method. |
| sdk/core/core-client-rest/test/internal/clientHelpers.spec.ts | Adds coverage for getCachedDefaultHttpsClient instance caching. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
xirzec
previously requested changes
Apr 17, 2026
…ptions promotion Replace trivial empty-object test with one that passes requestOptions fields (timeout, headers, skipUrlEncoding, etc.) and asserts they get promoted to root-level RequestParameters. Also test onResponse passthrough. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… find() The find() callback already matches by policy name, so asserting strictEqual on .name after isDefined is redundant. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- browser/node streams: add assert.fail after await to catch missing errors - browser streams: assert.equal(done, false) → assert.isFalse(done) - createRestError: fix misleading 'standard error' test name Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- operationOptionHelpers: equal(x, true) → isTrue - clientHelpers: isDefined(policies) → isAbove(policies.length, 0) - getClient: assert(client) → assert.isDefined(client) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rest tests Replace try/catch + assert.fail() with rejects.toThrow(), hand-rolled boolean flags with vi.fn(), and assert.equal(x, undefined) with assert.isUndefined(x). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
012f678 to
3715d87
Compare
… tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jeremymeng
approved these changes
Apr 21, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jeremymeng
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
New test files
Expanded existing tests
Test quality improvements