diff --git a/sdk/eventhub/event-hubs/test/internal/sender.spec.ts b/sdk/eventhub/event-hubs/test/internal/sender.spec.ts index 6a837168022e..5db03b63cf16 100644 --- a/sdk/eventhub/event-hubs/test/internal/sender.spec.ts +++ b/sdk/eventhub/event-hubs/test/internal/sender.spec.ts @@ -25,6 +25,7 @@ import { AbortController } from "@azure/abort-controller"; import { SpanGraph, TestSpan } from "@azure/core-tracing"; import { TRACEPARENT_PROPERTY } from "../../src/diagnostics/instrumentEventData"; import { SubscriptionHandlerForTests } from "../public/utils/subscriptionHandlerForTests"; +import { StandardAbortMessage } from "../../src/util/timeoutAbortSignalUtils"; const env = getEnvVars(); describe("EventHub Sender", function(): void { @@ -483,7 +484,7 @@ describe("EventHub Sender", function(): void { throw new Error(`Test failure`); } catch (err) { err.name.should.equal("AbortError"); - err.message.should.equal("The create batch operation has been cancelled by the user."); + err.message.should.equal(StandardAbortMessage); } }); @@ -497,7 +498,7 @@ describe("EventHub Sender", function(): void { throw new Error(`Test failure`); } catch (err) { err.name.should.equal("AbortError"); - err.message.should.equal("The create batch operation has been cancelled by the user."); + err.message.should.equal(StandardAbortMessage); } }); }); @@ -976,7 +977,7 @@ describe("EventHub Sender", function(): void { throw new Error(`Test failure`); } catch (err) { err.name.should.equal("AbortError"); - err.message.should.equal("The send operation has been cancelled by the user."); + err.message.should.equal(StandardAbortMessage); } }); @@ -996,7 +997,7 @@ describe("EventHub Sender", function(): void { throw new Error(`Test failure`); } catch (err) { err.name.should.equal("AbortError"); - err.message.should.equal("The send operation has been cancelled by the user."); + err.message.should.equal(StandardAbortMessage); } }); diff --git a/sdk/eventhub/event-hubs/test/public/hubruntime.spec.ts b/sdk/eventhub/event-hubs/test/public/hubruntime.spec.ts index ea361a003154..2c932f393c7d 100644 --- a/sdk/eventhub/event-hubs/test/public/hubruntime.spec.ts +++ b/sdk/eventhub/event-hubs/test/public/hubruntime.spec.ts @@ -75,7 +75,7 @@ describe("RuntimeInformation", function(): void { }); throw new Error(`Test failure`); } catch (err) { - err.message.should.match(/The [\w]+ operation has been cancelled by the user.$/gi); + err.message.should.equal("The operation was aborted."); } }); @@ -88,7 +88,7 @@ describe("RuntimeInformation", function(): void { }); throw new Error(`Test failure`); } catch (err) { - err.message.should.match(/The [\w]+ operation has been cancelled by the user.$/gi); + err.message.should.equal("The operation was aborted."); } }); @@ -201,7 +201,7 @@ describe("RuntimeInformation", function(): void { }); throw new Error(`Test failure`); } catch (err) { - err.message.should.match(/The [\w]+ operation has been cancelled by the user.$/gi); + err.message.should.equal("The operation was aborted."); } }); @@ -216,7 +216,7 @@ describe("RuntimeInformation", function(): void { }); throw new Error(`Test failure`); } catch (err) { - err.message.should.match(/The [\w]+ operation has been cancelled by the user.$/gi); + err.message.should.equal("The operation was aborted."); } }); @@ -413,7 +413,7 @@ describe("RuntimeInformation", function(): void { }); throw new Error(`Test failure`); } catch (err) { - err.message.should.match(/The [\w]+ operation has been cancelled by the user.$/gi); + err.message.should.equal("The operation was aborted."); } }); @@ -428,7 +428,7 @@ describe("RuntimeInformation", function(): void { }); throw new Error(`Test failure`); } catch (err) { - err.message.should.match(/The [\w]+ operation has been cancelled by the user.$/gi); + err.message.should.equal("The operation was aborted."); } });