Skip to content

Commit

Permalink
fix wrong mock api introduced by #741 (#748)
Browse files Browse the repository at this point in the history
* fix wrong mock api introduced by #741

* changeset
  • Loading branch information
tadelesh authored Oct 11, 2024
1 parent fcb04a2 commit 311617f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-dragons-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@azure-tools/cadl-ranch-specs": patch
---

fix wrong mock api introduced by #741
6 changes: 3 additions & 3 deletions packages/cadl-ranch-specs/http/azure/core/basic/mockapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ Scenarios.Azure_Core_Basic_list = passOnSuccess({
req.expect.containsQueryParam("skip", "10");
req.expect.containsQueryParam("orderby", "id");
req.expect.containsQueryParam("filter", "id lt 10");
if (!req.originalRequest.originalUrl.includes("select[]=id&select[]=orders&select[]=etag")) {
if (!req.originalRequest.originalUrl.includes("select=id&select=orders&select=etag")) {
throw new ValidationError(
"Expected query param select[]=id&select[]=orders&select[]=etag ",
"select[]=id&select[]=orders&select[]=etag",
"Expected query param select=id&select=orders&select=etag ",
"select=id&select=orders&select=etag",
req.originalRequest.originalUrl,
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cadl-ranch-specs/http/encode/bytes/mockapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ Scenarios.Encode_Bytes_RequestBody_base64 = createRequestBodyServerTests(
);
Scenarios.Encode_Bytes_RequestBody_base64url = createRequestBodyServerTests(
"/encode/bytes/body/request/base64url",
'"dGVzdA=="',
'"dGVzdA"',
{
"Content-Type": "application/json",
},
'"dGVzdA=="',
'"dGVzdA"',
);
function createResponseBodyServerTests(
uri: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,12 @@ Scenarios.Parameters_BodyOptionality_OptionalExplicit = passOnSuccess([
{
uri: "/parameters/body-optionality/optional-explicit/omit",
method: "post",
request: {
body: {
name: "foo",
},
},
request: {},
response: {
status: 204,
},
handler: (req: MockRequest) => {
req.expect.bodyEquals({ name: "foo" });
req.expect.rawBodyEquals(undefined);
return { status: 204 };
},
kind: "MockApiDefinition",
Expand Down

0 comments on commit 311617f

Please sign in to comment.