Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramya Raja committed Jan 14, 2020
1 parent 7e94dfa commit 5f7b75e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion sdk/servicebus/service-bus/test/batchReceiver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ describe("Batch Receiver - Settle deadlettered message", function(): void {
const deadLetterMsg = await deadLetterMessage(testMessage);

await deadLetterMsg.deadLetter().catch((err) => {
should.equal(err.code, "InvalidOperationError", "ErrorName is different than expected");
should.equal(err.code, "InvalidOperationError", "Error code is different than expected");
errorWasThrown = true;
});

Expand Down
4 changes: 2 additions & 2 deletions sdk/servicebus/service-bus/test/renewLock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ async function testBatchReceiverManualLockRenewalErrorOnLockExpiry(

let errorWasThrown: boolean = false;
await msgs[0].complete().catch((err) => {
should.equal(err.code, "MessageLockLostError", "ErrorName is different than expected");
should.equal(err.code, "MessageLockLostError", "Error code is different than expected");
errorWasThrown = true;
});

Expand Down Expand Up @@ -433,7 +433,7 @@ async function testAutoLockRenewalConfigBehavior(

let errorWasThrown: boolean = false;
await brokeredMessage.complete().catch((err) => {
should.equal(err.code, "MessageLockLostError", "ErrorName is different than expected");
should.equal(err.code, "MessageLockLostError", "Error code is different than expected");
errorWasThrown = true;
});

Expand Down
4 changes: 2 additions & 2 deletions sdk/servicebus/service-bus/test/renewLockSessions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ async function testBatchReceiverManualLockRenewalErrorOnLockExpiry(

let errorWasThrown: boolean = false;
await msgs[0].complete().catch((err) => {
should.equal(err.code, "SessionLockLostError", "ErrorName is different than expected");
should.equal(err.code, "SessionLockLostError", "Error code is different than expected");
errorWasThrown = true;
});

Expand Down Expand Up @@ -482,7 +482,7 @@ async function testAutoLockRenewalConfigBehavior(

let errorWasThrown: boolean = false;
await messagesReceived[0].complete().catch((err) => {
should.equal(err.code, "SessionLockLostError", "ErrorName is different than expected");
should.equal(err.code, "SessionLockLostError", "Error code is different than expected");
errorWasThrown = true;
});

Expand Down
30 changes: 16 additions & 14 deletions sdk/servicebus/service-bus/test/serviceBusClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ import {
} from "./utils/testUtils";
import { ClientType } from "../src/client";
import { DispositionType } from "../src/serviceBusMessage";
import { isNode } from "./utils/envVarUtils";

const should = chai.should();
chai.use(chaiAsPromised);

describe("Create ServiceBusClient and Queue/Topic/Subscription Clients #RunInBrowser", function(): void {
describe.only("Create ServiceBusClient and Queue/Topic/Subscription Clients #RunInBrowser", function(): void {
let sbClient: ServiceBusClient;

afterEach(async () => {
Expand Down Expand Up @@ -85,7 +86,7 @@ describe("Create ServiceBusClient and Queue/Topic/Subscription Clients #RunInBro
// });
});

describe("Errors with non existing Namespace #RunInBrowser", function(): void {
describe.only("Errors with non existing Namespace #RunInBrowser", function(): void {
let sbClient: ServiceBusClient;
let errorWasThrown: boolean;
beforeEach(() => {
Expand All @@ -99,10 +100,11 @@ describe("Errors with non existing Namespace #RunInBrowser", function(): void {
});

const testError = (err: Error): void => {
const expectedErrCode = isNode ? "ENOTFOUND" : "ServiceCommunicationError";
should.equal(
(err as MessagingError).code,
"ServiceCommunicationError",
"ErrorName is different than expected"
expectedErrCode,
"Error code is different than expected"
);
errorWasThrown = true;
};
Expand Down Expand Up @@ -191,7 +193,7 @@ describe("Errors with non existing Namespace #RunInBrowser", function(): void {
});
});

describe("Errors with non existing Queue/Topic/Subscription", async function(): Promise<void> {
describe.only("Errors with non existing Queue/Topic/Subscription", async function(): Promise<void> {
let sbClient: ServiceBusClient;
let errorWasThrown: boolean;
beforeEach(() => {
Expand All @@ -206,7 +208,7 @@ describe("Errors with non existing Queue/Topic/Subscription", async function():
should.equal(
(err as MessagingError).code,
"MessagingEntityNotFoundError",
"ErrorName is different than expected"
"Error code is different than expected"
);
should.equal(
err.message.startsWith(
Expand Down Expand Up @@ -318,7 +320,7 @@ describe("Errors with non existing Queue/Topic/Subscription", async function():
});
});

// describe("Test createFromAadTokenCredentials", function(): void {
// describe.only("Test createFromAadTokenCredentials", function(): void {
// let sbClient: ServiceBusClient;
// let errorWasThrown: boolean = false;

Expand Down Expand Up @@ -392,7 +394,7 @@ describe("Errors with non existing Queue/Topic/Subscription", async function():
// });
// });

describe("Errors after close()", function(): void {
describe.only("Errors after close()", function(): void {
let sbClient: ServiceBusClient;
let senderClient: QueueClient | TopicClient;
let receiverClient: QueueClient | SubscriptionClient;
Expand Down Expand Up @@ -755,7 +757,7 @@ describe("Errors after close()", function(): void {
should.equal(errorGetRules, expectedErrorMsg, "Expected error not thrown for getRule()");
}

describe("Errors after close() on namespace", function(): void {
describe.only("Errors after close() on namespace", function(): void {
const entityToClose = "namespace";
const expectedErrorMsg = "The underlying AMQP connection is closed.";

Expand Down Expand Up @@ -872,7 +874,7 @@ describe("Errors after close()", function(): void {
});
});

describe("Errors after close() on senderClient", function(): void {
describe.only("Errors after close() on senderClient", function(): void {
const entityToClose = "senderClient";

it("Unpartitioned Queue: errors after close() on senderClient #RunInBrowser", async function(): Promise<
Expand Down Expand Up @@ -906,7 +908,7 @@ describe("Errors after close()", function(): void {
});
});

describe("Errors after close() on receiverClient", function(): void {
describe.only("Errors after close() on receiverClient", function(): void {
const entityToClose = "receiverClient";

it("Unpartitioned Queue: errors after close() on receiverClient #RunInBrowser", async function(): Promise<
Expand Down Expand Up @@ -984,7 +986,7 @@ describe("Errors after close()", function(): void {
});
});

describe("Errors after close() on sender", function(): void {
describe.only("Errors after close() on sender", function(): void {
const entityToClose = "sender";

it("Unpartitioned Queue: errors after close() on sender #RunInBrowser", async function(): Promise<
Expand All @@ -1002,7 +1004,7 @@ describe("Errors after close()", function(): void {
});
});

describe("Errors after close() on receiver", function(): void {
describe.only("Errors after close() on receiver", function(): void {
const entityToClose = "receiver";

it("Unpartitioned Queue: errors after close() on receiver #RunInBrowser", async function(): Promise<
Expand Down Expand Up @@ -1042,7 +1044,7 @@ describe("Errors after close()", function(): void {
});
});

describe("Errors when creating second sender/receiver with first not closed", function(): void {
describe.only("Errors when creating second sender/receiver with first not closed", function(): void {
it("Open sender exists on QueueClient", async function(): Promise<void> {
await beforeEachTest(TestClientType.PartitionedQueue, TestClientType.PartitionedQueue, "");

Expand Down
4 changes: 2 additions & 2 deletions sdk/servicebus/service-bus/test/topicFilters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ describe("addRule() #RunInBrowser", function(): void {
should.equal(
error.code,
"MessagingEntityAlreadyExistsError",
"ErrorName is different than expected"
"Error code is different than expected"
);
}
should.equal(errorWasThrown, true, "Error thrown flag must be true");
Expand Down Expand Up @@ -272,7 +272,7 @@ describe("removeRule()", function(): void {
should.equal(
error.code,
"MessagingEntityNotFoundError",
"ErrorName is different than expected"
"Error code is different than expected"
);
errorWasThrown = true;
}
Expand Down

0 comments on commit 5f7b75e

Please sign in to comment.