Skip to content

Commit

Permalink
[Schema Registry] Add Json package in ci.yml file (Azure#26746)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhanh-phan authored Aug 8, 2023
1 parent 414d5ad commit 092094d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions sdk/schemaregistry/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ extends:
safeName: azureschemaregistry
- name: azure-schema-registry-avro
safeName: azureschemaregistryavro
- name: azure-schema-registry-json
safeName: azureschemaregistryjson
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { assert, isNode } from "@azure/test-utils";
import { assert } from "@azure/test-utils";
import { JsonSerializer } from "../../src";
import { Context } from "mocha";
import { SchemaRegistry } from "@azure/schema-registry";
Expand Down Expand Up @@ -165,6 +165,9 @@ describe("Error scenarios", function () {
);
});
it("schema with invalid ID", async function () {
if (!isLiveMode()) {
this.skip();
}
await assertError(
serializer.serialize(
null,
Expand Down Expand Up @@ -219,24 +222,20 @@ describe("Error scenarios", function () {
44, 34, 110, 97, 109, 101, 34, 58, 34, 120, 34, 125,
])
);
// const nodeMessage = /Unexpected end of JSON input/;
serializedValue.data = Uint8Array.from([
123, 34, 102, 97, 118, 111, 114, 105, 116, 101, 78, 117, 109, 98, 101, 114,
]);

await assertError(serializer.deserialize(serializedValue), {
causeMessage: isNode
? /Unexpected end of JSON input/
: /Unterminated string in JSON at position/,
causeMessage: /[Unexpected end of JSON input]|[Unterminated string in JSON at position]/,
});
serializedValue.data = Uint8Array.from([
123, 34, 102, 97, 118, 111, 114, 105, 116, 101, 78, 117, 109, 98, 101, 114, 34, 58, 49, 44,
34, 110, 97, 109, 101, 34, 58, 34, 120, 34, 125, 110,
]);
await assertError(serializer.deserialize(serializedValue), {
causeMessage: isNode
? /Unexpected token n in JSON at position/
: /Unexpected non-whitespace character/,
causeMessage:
/[Unexpected token n in JSON at position]|[Unexpected non-whitespace character]/,
});
});
});
Expand Down

0 comments on commit 092094d

Please sign in to comment.