Skip to content

Commit

Permalink
No need of the if checks
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshaNalluru committed Aug 26, 2021
1 parent 293f78a commit 63bdbcd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 4 additions & 8 deletions sdk/test-utils/testing-recorder-new/test/core-v1-test.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { isLiveMode, env } from "@azure/test-utils-recorder";
import { env } from "@azure/test-utils-recorder";
import { QueueServiceClient, StoragePipelineOptions } from "@azure/storage-queue";
import { TestProxyHttpClientCoreV1 } from "@azure/test-utils-recorder-new";
import { config } from "dotenv";
Expand All @@ -13,14 +13,10 @@ describe("Tests", () => {
const file = (isNode ? "node_" : "browser_") + `core_v1_file_path.json`;
const recorder = new TestProxyHttpClientCoreV1(file);
const options: StoragePipelineOptions = {};
if (!isLiveMode()) {
options.httpClient = recorder;
}
options.httpClient = recorder;
const client = new QueueServiceClient(env.STORAGE_SAS_URL, undefined, options);
if (!isLiveMode()) await recorder.start();

await recorder.start();
await client.createQueue((isNode ? "node-" : "browser-") + "1320");

if (!isLiveMode()) await recorder.stop();
await recorder.stop();
});
});
10 changes: 4 additions & 6 deletions sdk/test-utils/testing-recorder-new/test/core-v2-test.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { isLiveMode, env } from "@azure/test-utils-recorder";
import { env } from "@azure/test-utils-recorder";
import { TableEntity, TableClient } from "@azure/data-tables";
import { TestProxyHttpClient, recorderHttpPolicy } from "@azure/test-utils-recorder-new";
import { config } from "dotenv";
Expand All @@ -14,14 +14,12 @@ describe("Tests", () => {
const file = (isNode ? "node_" : "browser_") + `core_v2_file_path.json`;
const recorder = new TestProxyHttpClient(file);
const client = TableClient.fromConnectionString(env.TABLES_SAS_CONNECTION_STRING, "newtable");
if (!isLiveMode()) {
client.pipeline.addPolicy(recorderHttpPolicy(recorder));
}
if (!isLiveMode()) await recorder.start();
client.pipeline.addPolicy(recorderHttpPolicy(recorder));
await recorder.start();
await client.createTable();
const simpleEntity: TableEntity = createSimpleEntity();
await client.createEntity(simpleEntity);
await client.deleteTable();
if (!isLiveMode()) await recorder.stop();
await recorder.stop();
});
});

0 comments on commit 63bdbcd

Please sign in to comment.