|
1 | 1 | // Copyright (c) Microsoft Corporation.
|
2 | 2 | // Licensed under the MIT license.
|
3 | 3 |
|
4 |
| -import { assert, isNode } from "@azure/test-utils"; |
| 4 | +import { assert } from "@azure/test-utils"; |
5 | 5 | import { JsonSerializer } from "../../src";
|
6 | 6 | import { Context } from "mocha";
|
7 | 7 | import { SchemaRegistry } from "@azure/schema-registry";
|
@@ -165,6 +165,9 @@ describe("Error scenarios", function () {
|
165 | 165 | );
|
166 | 166 | });
|
167 | 167 | it("schema with invalid ID", async function () {
|
| 168 | + if (!isLiveMode()) { |
| 169 | + this.skip(); |
| 170 | + } |
168 | 171 | await assertError(
|
169 | 172 | serializer.serialize(
|
170 | 173 | null,
|
@@ -219,24 +222,20 @@ describe("Error scenarios", function () {
|
219 | 222 | 44, 34, 110, 97, 109, 101, 34, 58, 34, 120, 34, 125,
|
220 | 223 | ])
|
221 | 224 | );
|
222 |
| - // const nodeMessage = /Unexpected end of JSON input/; |
223 | 225 | serializedValue.data = Uint8Array.from([
|
224 | 226 | 123, 34, 102, 97, 118, 111, 114, 105, 116, 101, 78, 117, 109, 98, 101, 114,
|
225 | 227 | ]);
|
226 | 228 |
|
227 | 229 | await assertError(serializer.deserialize(serializedValue), {
|
228 |
| - causeMessage: isNode |
229 |
| - ? /Unexpected end of JSON input/ |
230 |
| - : /Unterminated string in JSON at position/, |
| 230 | + causeMessage: /[Unexpected end of JSON input]|[Unterminated string in JSON at position]/, |
231 | 231 | });
|
232 | 232 | serializedValue.data = Uint8Array.from([
|
233 | 233 | 123, 34, 102, 97, 118, 111, 114, 105, 116, 101, 78, 117, 109, 98, 101, 114, 34, 58, 49, 44,
|
234 | 234 | 34, 110, 97, 109, 101, 34, 58, 34, 120, 34, 125, 110,
|
235 | 235 | ]);
|
236 | 236 | await assertError(serializer.deserialize(serializedValue), {
|
237 |
| - causeMessage: isNode |
238 |
| - ? /Unexpected token n in JSON at position/ |
239 |
| - : /Unexpected non-whitespace character/, |
| 237 | + causeMessage: |
| 238 | + /[Unexpected token n in JSON at position]|[Unexpected non-whitespace character]/, |
240 | 239 | });
|
241 | 240 | });
|
242 | 241 | });
|
|
0 commit comments