Skip to content

Commit

Permalink
ImperativeConfig.envVariablePrefix
Browse files Browse the repository at this point in the history
Signed-off-by: Amber Torrise <[email protected]>
  • Loading branch information
Amber Torrise committed Nov 9, 2023
1 parent 0e78a91 commit 42409bd
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const fakeSession: any = {
describe("Auth Login APIML unit tests", () => {

beforeEach(() => {
/* This avoids having to mock ImperativeConfig.envVariablePrefix.
/* This avoids having to mock ImperativeConfig.instance.envVariablePrefix.
* Unless the choice below is overridden, tests will use our legacy format for errors.
*/
jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const fakeSession: any = {
describe("Auth Logout APIML unit tests", () => {

beforeEach(() => {
/* This avoids having to mock ImperativeConfig.envVariablePrefix.
/* This avoids having to mock ImperativeConfig.instance.envVariablePrefix.
* Unless overridden, tests will use our legacy format for errors.
*/
jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { IImperativeError, NextVerFeatures, RestConstants, SessConstants, Sessio
describe("ZosmfRestClient tests", () => {

beforeEach(() => {
/* This avoids having to mock ImperativeConfig.envVariablePrefix.
/* This avoids having to mock ImperativeConfig.instance.envVariablePrefix.
* Unless the choice below is overridden, tests will use our legacy format for errors.
*/
jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,11 @@ describe("Imperative", () => {

beforeEach(() => {
loggingConfig = mocks.LoggingConfigurer.configureLogger("dont care", {});
envConfig = mocks.EnvironmentalVariableSettings.read(Imperative.envVariablePrefix);
envConfig = mocks.EnvironmentalVariableSettings.read(mocks.ImperativeConfig.instance.envVariablePrefix);
});

it("should know what the envVariablePrefix is [DEPRECATED]", async () => {
expect(Imperative.envVariablePrefix).toEqual(defaultConfig.name);
expect(mocks.ImperativeConfig.instance.envVariablePrefix).toEqual(defaultConfig.name);
});

it("should handle a valid imperative log level", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const getIHandlerParametersObject = (): IHandlerParameters => {

describe("Configuration Import command handler", () => {
beforeEach(() => {
/* This avoids having to mock ImperativeConfig.envVariablePrefix.
/* This avoids having to mock ImperativeConfig.instance.envVariablePrefix.
* Unless overridden, tests will use our legacy format for errors.
*/
jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false);
Expand Down
9 changes: 0 additions & 9 deletions packages/imperative/src/imperative/src/Imperative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,6 @@ export class Imperative {
return TextUtils.chalk[ImperativeConfig.instance.loadedConfig.primaryTextColor](text);
}

/**
* Get the configured environmental variable prefix for the user's CLI
* @returns {string} - the configured or default prefix for environmental variables for use in the environmental variable service
* @deprecated Please use ImperativeConfig.instance.envVariablePrefix
*/
public static get envVariablePrefix(): string {
return ImperativeConfig.instance.envVariablePrefix;
}

/**
* Highlight text with your configured (or default) secondary color
* @param {string} text - the text to highlight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { IO } from "../../../io";
describe("AbstractRestClient tests", () => {

beforeEach(() => {
/* This avoids having to mock ImperativeConfig.envVariablePrefix.
/* This avoids having to mock ImperativeConfig.instance.envVariablePrefix.
* Unless overridden, tests will use our legacy format for errors.
*/
jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("RestClient tests", () => {
beforeEach(() => {
jest.clearAllMocks();

/* This avoids having to mock ImperativeConfig.envVariablePrefix.
/* This avoids having to mock ImperativeConfig.instance.envVariablePrefix.
* Unless overridden, tests will use our legacy format for errors.
*/
jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("z/OS Files - Upload", () => {
let error: any;

beforeEach(() => {
/* This avoids having to mock ImperativeConfig.envVariablePrefix.
/* This avoids having to mock ImperativeConfig.instance.envVariablePrefix.
* Unless the choice below is overridden, tests will use our legacy format for errors.
*/
jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false);
Expand Down
2 changes: 1 addition & 1 deletion packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function mockGetJobsServerError(errorCode: string, causeErrors: string) {
describe("GetJobs tests", () => {

beforeEach(() => {
/* This avoids having to mock ImperativeConfig.envVariablePrefix.
/* This avoids having to mock ImperativeConfig.instance.envVariablePrefix.
* Unless overridden, tests will use our legacy format for errors.
*/
jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false);
Expand Down

0 comments on commit 42409bd

Please sign in to comment.