Skip to content

Commit

Permalink
fix: confidential-ledger-rest: remove mocha arrow functions (#25148)
Browse files Browse the repository at this point in the history
### 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)_

#23761 - Same fix, but for the `sdk\search\search-documents` package
#23789 - Same fix but for the `sdk\attestation\attestation` package
#23835 - Same fix but for the `sdk\batch\batch` package
#23850 - Same fix but for the
`sdk\cognitivelanguage\ai-language-conversations` package
#23881 - Same fix but for the
`sdk\cognitiveservices\cognitiveservices-luis-authoring` package
#24126 - Same fix but for the
`sdk\cognitiveservices\cognitiveservices-luis-runtime` package
#21470 - Same fix but for the `sdk\communication\communication-chat`
package
#24746 - Same fix but for the `sdk\communication\communication-common`
package
#24747 - Same fix but for the `sdk\communication\communication-email`
package
#24797 - Same fix but for the `sdk\communication\communication-identity`
package
#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_**
  • Loading branch information
StevanFreeborn authored Mar 13, 2023
1 parent 62806a2 commit 2cfc9ad
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import { ConfidentialLedgerClient, isUnexpected } from "../../src";
import { createClient, createRecorder } from "./utils/recordedClient";

import { Context } from "mocha";
import { EnclaveQuoteOutput } from "../../src";
import { Recorder } from "@azure-tools/test-recorder";
import { assert } from "chai";
import { Context } from "mocha";
import { EnclaveQuoteOutput } from "../../src";

describe("Colder endpoints", () => {
describe("Colder endpoints", function () {
let recorder: Recorder;
let client: ConfidentialLedgerClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import {
ConfidentialLedgerClient,
CreateLedgerEntryParameters,
LedgerEntry,
isUnexpected,
LedgerEntry,
} from "../../src";
import { createClient, createRecorder } from "./utils/recordedClient";

import { Context } from "mocha";
import { Recorder } from "@azure-tools/test-recorder";
import { assert } from "chai";
import { Context } from "mocha";

describe("Get Collections", () => {
describe("Get Collections", function () {
let recorder: Recorder;
let client: ConfidentialLedgerClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
import {
ConfidentialLedgerClient,
CreateLedgerEntryParameters,
LedgerEntry,
isUnexpected,
LedgerEntry,
paginate,
} from "../../src";

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

import { Context } from "mocha";
import { Recorder } from "@azure-tools/test-recorder";
import { assert } from "chai";
import { Context } from "mocha";

describe("Range query should be successful", () => {
describe("Range query should be successful", function () {
let recorder: Recorder;
let client: ConfidentialLedgerClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Recorder } from "@azure-tools/test-recorder";
import { assert } from "chai";
import { env } from "process";

describe("Get ledger history", () => {
describe("Get ledger history", function () {
let recorder: Recorder;
let client: ConfidentialLedgerClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import { ConfidentialLedgerClient, isUnexpected } from "../../src";
import { createClient, createRecorder } from "./utils/recordedClient";

import { Context } from "mocha";
import { Recorder } from "@azure-tools/test-recorder";
import { assert } from "chai";
import { Context } from "mocha";

describe("List Enclaves", () => {
describe("List Enclaves", function () {
let recorder: Recorder;
let client: ConfidentialLedgerClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Context } from "mocha";
import { Recorder } from "@azure-tools/test-recorder";
import { assert } from "chai";

describe("Post transaction", () => {
describe("Post transaction", function () {
let recorder: Recorder;
let client: ConfidentialLedgerClient;
let contentBody: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createClient, createRecorder } from "./utils/recordedClient";
import { Context } from "mocha";
import { DefaultAzureCredential } from "@azure/identity";

describe("Test user authentications", () => {
describe("Test user authentications", function () {
let recorder: Recorder;

beforeEach(async function (this: Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createClient, createRecorder } from "./utils/recordedClient";
import { Context } from "mocha";
import { assert } from "chai";

describe("Get user", () => {
describe("Get user", function () {
let recorder: Recorder;
let client: ConfidentialLedgerClient;

Expand Down

0 comments on commit 2cfc9ad

Please sign in to comment.