Files
Matthew PodwysockiandGitHub fa2305e05a [devhub] Migrate devhub projects to use snippets extraction (#32979)
### Packages impacted by this PR

- @azure/arm-devhub

### Issues associated with this PR

- https://github.com/Azure/azure-sdk-for-js/issues/32416

### Describe the problem that is addressed by this PR

Updates all projects under `devhub` to use snippets extraction.

### 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?


### Are there test cases added in this PR? _(If not, why?)_


### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [ ] 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)_
- [ ] Added a changelog (if necessary)
2025-02-11 17:42:23 -05:00

65 lines
2.1 KiB
TypeScript

/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import type { RecorderStartOptions } from "@azure-tools/test-recorder";
import { env, Recorder, isPlaybackMode } from "@azure-tools/test-recorder";
import { createTestCredential } from "@azure-tools/test-credential";
import { DeveloperHubServiceClient } from "../src/developerHubServiceClient.js";
import { describe, it, beforeEach, afterEach } from "vitest";
const replaceableVariables: Record<string, string> = {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
SUBSCRIPTION_ID: "azure_subscription_id",
};
const recorderOptions: RecorderStartOptions = {
envSetupForPlayback: replaceableVariables,
removeCentralSanitizers: [
"AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section
"AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section
],
};
export const testPollingOptions = {
updateIntervalInMs: isPlaybackMode() ? 0 : undefined,
};
describe("devhub test", () => {
let recorder: Recorder;
let subscriptionId: string;
let client: DeveloperHubServiceClient;
let resourceGroup: string;
beforeEach(async (ctx) => {
recorder = new Recorder(ctx);
await recorder.start(recorderOptions);
subscriptionId = env.SUBSCRIPTION_ID || "";
// This is an example of how the environment variables are used
const credential = createTestCredential();
client = new DeveloperHubServiceClient(
credential,
subscriptionId,
recorder.configureClientOptions({}),
);
resourceGroup = "myjstest";
});
afterEach(async () => {
await recorder.stop();
});
it("workflow list test", async () => {
const resArray = new Array();
for await (const item of client.workflowOperations.listByResourceGroup(resourceGroup)) {
resArray.push(item);
}
});
});