diff --git a/.chronus/changes/fix-encode-duration-tests-2025-11-25-04-18-59.md b/.chronus/changes/fix-encode-duration-tests-2025-11-25-04-18-59.md new file mode 100644 index 00000000000..16a7b59f680 --- /dev/null +++ b/.chronus/changes/fix-encode-duration-tests-2025-11-25-04-18-59.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-specs" +--- + +Fix EncodeDuration tests with larger unit durations being too strict by making query parameter expectations match input types as numbers instead of strings diff --git a/packages/http-specs/specs/encode/duration/mockapi.ts b/packages/http-specs/specs/encode/duration/mockapi.ts index 157858bc68c..e77b3f4ab90 100644 --- a/packages/http-specs/specs/encode/duration/mockapi.ts +++ b/packages/http-specs/specs/encode/duration/mockapi.ts @@ -229,9 +229,9 @@ Scenarios.Encode_Duration_Query_int32SecondsLargerUnit = createQueryServerTests( Scenarios.Encode_Duration_Query_floatSecondsLargerUnit = createQueryServerTests( "/encode/duration/query/float-seconds-larger-unit", { - input: 150.0, + input: 150, }, - "150.0", + 150, ); Scenarios.Encode_Duration_Query_int32MillisecondsLargerUnit = createQueryServerTests( "/encode/duration/query/int32-milliseconds-larger-unit", @@ -243,9 +243,9 @@ Scenarios.Encode_Duration_Query_int32MillisecondsLargerUnit = createQueryServerT Scenarios.Encode_Duration_Query_floatMillisecondsLargerUnit = createQueryServerTests( "/encode/duration/query/float-milliseconds-larger-unit", { - input: 210000.0, + input: 210000, }, - "210000.0", + 210000, ); function createHeaderServerTests(uri: string, headersData: any, value: any) { @@ -343,9 +343,9 @@ Scenarios.Encode_Duration_Header_int32SecondsLargerUnit = createHeaderServerTest Scenarios.Encode_Duration_Header_floatSecondsLargerUnit = createHeaderServerTests( "/encode/duration/header/float-seconds-larger-unit", { - duration: "150.0", + duration: "150", }, - "150.0", + "150", ); Scenarios.Encode_Duration_Header_int32MillisecondsLargerUnit = createHeaderServerTests( "/encode/duration/header/int32-milliseconds-larger-unit", @@ -357,7 +357,7 @@ Scenarios.Encode_Duration_Header_int32MillisecondsLargerUnit = createHeaderServe Scenarios.Encode_Duration_Header_floatMillisecondsLargerUnit = createHeaderServerTests( "/encode/duration/header/float-milliseconds-larger-unit", { - duration: "210000.0", + duration: "210000", }, - "210000.0", + "210000", );