Skip to content

Commit 2cfc9ad

Browse files
fix: confidential-ledger-rest: remove mocha arrow functions (Azure#25148)
### Packages impacted by this PR `sdk\confidentialledger\confidential-ledger-rest` ### Issues associated with this PR #13005 ### Describe the problem that is addressed by this PR The existing mocha tests for the `sdk\confidentialledger\confidential-ledger-rest` made use of the arrow syntax for callback functions. Mocha recommends not to do this because you lose access to the mocha context (https://mochajs.org/#arrow-functions). ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? The reason for utilizing the function keyword instead of an arrow syntax to write the callback functions in these mocha tests is to maintain access to the mocha context. ### Are there test cases added in this PR? _(If not, why?)_ No additional test cases were added in this PR as the change only required modifying existing test cases. ### Provide a list of related PRs _(if any)_ Azure#23761 - Same fix, but for the `sdk\search\search-documents` package Azure#23789 - Same fix but for the `sdk\attestation\attestation` package Azure#23835 - Same fix but for the `sdk\batch\batch` package Azure#23850 - Same fix but for the `sdk\cognitivelanguage\ai-language-conversations` package Azure#23881 - Same fix but for the `sdk\cognitiveservices\cognitiveservices-luis-authoring` package Azure#24126 - Same fix but for the `sdk\cognitiveservices\cognitiveservices-luis-runtime` package Azure#21470 - Same fix but for the `sdk\communication\communication-chat` package Azure#24746 - Same fix but for the `sdk\communication\communication-common` package Azure#24747 - Same fix but for the `sdk\communication\communication-email` package Azure#24797 - Same fix but for the `sdk\communication\communication-identity` package Azure#24865 - Same fix but for the `sdk\communication\communication-job-router` package ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ **_Not applicable_** ### Checklists - [x] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - **_I don't believe this is relevant._** - [ ] Added a changelog (if necessary) - **_I don't believe this is necessary_**
1 parent 62806a2 commit 2cfc9ad

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

sdk/confidentialledger/confidential-ledger-rest/test/public/colderEndpoints.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import { ConfidentialLedgerClient, isUnexpected } from "../../src";
44
import { createClient, createRecorder } from "./utils/recordedClient";
55

6-
import { Context } from "mocha";
7-
import { EnclaveQuoteOutput } from "../../src";
86
import { Recorder } from "@azure-tools/test-recorder";
97
import { assert } from "chai";
8+
import { Context } from "mocha";
9+
import { EnclaveQuoteOutput } from "../../src";
1010

11-
describe("Colder endpoints", () => {
11+
describe("Colder endpoints", function () {
1212
let recorder: Recorder;
1313
let client: ConfidentialLedgerClient;
1414

sdk/confidentialledger/confidential-ledger-rest/test/public/getCollections.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
import {
44
ConfidentialLedgerClient,
55
CreateLedgerEntryParameters,
6-
LedgerEntry,
76
isUnexpected,
7+
LedgerEntry,
88
} from "../../src";
99
import { createClient, createRecorder } from "./utils/recordedClient";
1010

11-
import { Context } from "mocha";
1211
import { Recorder } from "@azure-tools/test-recorder";
1312
import { assert } from "chai";
13+
import { Context } from "mocha";
1414

15-
describe("Get Collections", () => {
15+
describe("Get Collections", function () {
1616
let recorder: Recorder;
1717
let client: ConfidentialLedgerClient;
1818

sdk/confidentialledger/confidential-ledger-rest/test/public/historicalRangeQuery.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
import {
44
ConfidentialLedgerClient,
55
CreateLedgerEntryParameters,
6-
LedgerEntry,
76
isUnexpected,
7+
LedgerEntry,
88
paginate,
99
} from "../../src";
1010

1111
import { createClient, createRecorder } from "./utils/recordedClient";
1212

13-
import { Context } from "mocha";
1413
import { Recorder } from "@azure-tools/test-recorder";
1514
import { assert } from "chai";
15+
import { Context } from "mocha";
1616

17-
describe("Range query should be successful", () => {
17+
describe("Range query should be successful", function () {
1818
let recorder: Recorder;
1919
let client: ConfidentialLedgerClient;
2020

sdk/confidentialledger/confidential-ledger-rest/test/public/ledgerHistory.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Recorder } from "@azure-tools/test-recorder";
88
import { assert } from "chai";
99
import { env } from "process";
1010

11-
describe("Get ledger history", () => {
11+
describe("Get ledger history", function () {
1212
let recorder: Recorder;
1313
let client: ConfidentialLedgerClient;
1414

sdk/confidentialledger/confidential-ledger-rest/test/public/listEnclaveQuotes.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import { ConfidentialLedgerClient, isUnexpected } from "../../src";
44
import { createClient, createRecorder } from "./utils/recordedClient";
55

6-
import { Context } from "mocha";
76
import { Recorder } from "@azure-tools/test-recorder";
87
import { assert } from "chai";
8+
import { Context } from "mocha";
99

10-
describe("List Enclaves", () => {
10+
describe("List Enclaves", function () {
1111
let recorder: Recorder;
1212
let client: ConfidentialLedgerClient;
1313

sdk/confidentialledger/confidential-ledger-rest/test/public/postTransaction.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Context } from "mocha";
1212
import { Recorder } from "@azure-tools/test-recorder";
1313
import { assert } from "chai";
1414

15-
describe("Post transaction", () => {
15+
describe("Post transaction", function () {
1616
let recorder: Recorder;
1717
let client: ConfidentialLedgerClient;
1818
let contentBody: string;

sdk/confidentialledger/confidential-ledger-rest/test/public/testUserAuth.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { createClient, createRecorder } from "./utils/recordedClient";
99
import { Context } from "mocha";
1010
import { DefaultAzureCredential } from "@azure/identity";
1111

12-
describe("Test user authentications", () => {
12+
describe("Test user authentications", function () {
1313
let recorder: Recorder;
1414

1515
beforeEach(async function (this: Context) {

sdk/confidentialledger/confidential-ledger-rest/test/public/usersEndpoint.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createClient, createRecorder } from "./utils/recordedClient";
77
import { Context } from "mocha";
88
import { assert } from "chai";
99

10-
describe("Get user", () => {
10+
describe("Get user", function () {
1111
let recorder: Recorder;
1212
let client: ConfidentialLedgerClient;
1313

0 commit comments

Comments
 (0)