From 8111dfd1fad2f8ea72e69392e55d0a4312310469 Mon Sep 17 00:00:00 2001 From: "Mingzhe Huang (from Dev Box)" Date: Mon, 14 Oct 2024 11:19:14 +0800 Subject: [PATCH] fix(test): adopt `coercedBodyEquals` For some cases (like Datetime), we should use `coercedBodyEquals` instead of `bodyEquals` --- .changeset/perfect-balloons-obey.md | 5 +++++ .../cadl-ranch-specs/http/type/property/nullable/mockapi.ts | 2 +- .../http/type/property/optionality/mockapi.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/perfect-balloons-obey.md diff --git a/.changeset/perfect-balloons-obey.md b/.changeset/perfect-balloons-obey.md new file mode 100644 index 000000000..24a312f66 --- /dev/null +++ b/.changeset/perfect-balloons-obey.md @@ -0,0 +1,5 @@ +--- +"@azure-tools/cadl-ranch-specs": patch +--- + +fix(test): adopt `coercedBodyEquals` diff --git a/packages/cadl-ranch-specs/http/type/property/nullable/mockapi.ts b/packages/cadl-ranch-specs/http/type/property/nullable/mockapi.ts index cc3377484..05416698b 100644 --- a/packages/cadl-ranch-specs/http/type/property/nullable/mockapi.ts +++ b/packages/cadl-ranch-specs/http/type/property/nullable/mockapi.ts @@ -36,7 +36,7 @@ function createServerTests(url: string, value: unknown, patchNullableProperty?: status: 204, }, handler: (req: MockRequest) => { - req.expect.bodyEquals({ + req.expect.coercedBodyEquals({ requiredProperty: "foo", nullableProperty: patchNullableProperty || null, }); diff --git a/packages/cadl-ranch-specs/http/type/property/optionality/mockapi.ts b/packages/cadl-ranch-specs/http/type/property/optionality/mockapi.ts index ba4b77390..fe4b39285 100644 --- a/packages/cadl-ranch-specs/http/type/property/optionality/mockapi.ts +++ b/packages/cadl-ranch-specs/http/type/property/optionality/mockapi.ts @@ -30,7 +30,7 @@ function createServerTests(url: string, value: unknown) { status: 204, }, handler: (req: MockRequest) => { - req.expect.bodyEquals(value); + req.expect.coercedBodyEquals(value); return { status: 204, };