From 67946c5b0ce135f58ecfeab1443e5be52604908e Mon Sep 17 00:00:00 2001 From: Deyaaeldeen Almahallawi Date: Thu, 28 Apr 2022 19:46:45 -0400 Subject: [PATCH] [Schema Registry Avro] Fix test (#21660) --- .../schema-registry-avro/test/public/avroSerializer.spec.ts | 5 +++-- .../test/public/utils/mockedRegistryClient.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/schemaregistry/schema-registry-avro/test/public/avroSerializer.spec.ts b/sdk/schemaregistry/schema-registry-avro/test/public/avroSerializer.spec.ts index b10689bb6c25..c14242d7c245 100644 --- a/sdk/schemaregistry/schema-registry-avro/test/public/avroSerializer.spec.ts +++ b/sdk/schemaregistry/schema-registry-avro/test/public/avroSerializer.spec.ts @@ -13,6 +13,7 @@ import { MessageContent } from "../../src/"; import chaiPromises from "chai-as-promised"; import { createTestRegistry } from "./utils/mockedRegistryClient"; import { isLive } from "./utils/isLive"; +import { v4 as uuid } from "uuid"; chaiUse(chaiPromises); @@ -145,9 +146,9 @@ describe("AvroSerializer", function () { await assert.isRejected( serializer.deserialize({ data, - contentType: "avro/binary+000", + contentType: `avro/binary+${uuid()}`, }), - `Schema does not exist` + /Schema id .* does not exist/ ); }); diff --git a/sdk/schemaregistry/schema-registry-avro/test/public/utils/mockedRegistryClient.ts b/sdk/schemaregistry/schema-registry-avro/test/public/utils/mockedRegistryClient.ts index cb7b44fb66b7..c06430f02aec 100644 --- a/sdk/schemaregistry/schema-registry-avro/test/public/utils/mockedRegistryClient.ts +++ b/sdk/schemaregistry/schema-registry-avro/test/public/utils/mockedRegistryClient.ts @@ -106,7 +106,7 @@ function createMockedTestRegistry(): SchemaRegistry { async function getSchema(id: string, _options?: GetSchemaOptions): Promise { const storedSchema = mapById.get(id); if (!storedSchema) { - throw new Error(`Schema does not exist: ${JSON.stringify(id)}`); + throw new Error(`Schema id ${id} does not exist`); } return storedSchema; }