Skip to content

Commit

Permalink
Make the samples and the tests use the same environment variable (and…
Browse files Browse the repository at this point in the history
… swap the environment variable to match the one the other SDKs agreed on)
  • Loading branch information
richardpark-msft committed Sep 11, 2019
1 parent 11de94e commit a066803
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { AppConfigurationClient } from "../src"

// allow loading from a .env file as an alternative to defining the variable
// in the environment
import * as dotenv from "dotenv";
dotenv.config();

export function getConnectionStringFromEnvironment() : string {
const connectionString = process.env["AZ_CONFIG_CONNECTION"]!;

Expand Down
6 changes: 2 additions & 4 deletions sdk/appconfiguration/app-configuration/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
// Licensed under the MIT License.

import * as assert from "assert";
import { getConnectionString } from "./testhelpers";
import { getConnectionStringFromEnvironment } from "../samples/sampleHelpers";
import * as dotenv from "dotenv";
import { AppConfigurationClient } from "../src";

dotenv.config();

describe("AppConfigurationClient", () => {
const settings: Array<{ key: string; label?: string }> = [];
const connectionString: string = process.env["APPCONFIG_CONNECTION_STRING"]!;

let client: AppConfigurationClient;

before("validate environment variables", () => {
let connectionString = getConnectionString();
let connectionString = getConnectionStringFromEnvironment();
client = new AppConfigurationClient(connectionString);
});

Expand All @@ -27,7 +26,6 @@ describe("AppConfigurationClient", () => {

describe("constructor", () => {
it("supports connection string", async () => {
const client = new AppConfigurationClient(connectionString);
// make sure a service call succeeds
await client.listConfigurationSettings();
});
Expand Down
10 changes: 0 additions & 10 deletions sdk/appconfiguration/app-configuration/test/testhelpers.ts

This file was deleted.

0 comments on commit a066803

Please sign in to comment.