This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gene Johnston <Eugene.Johnston@broadcom.com>
- Loading branch information
1 parent
3ae22d0
commit 21cd0fa
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import { ImperativeConfig } from "../src/ImperativeConfig"; | ||
import { NextVerFeatures } from "../src/NextVerFeatures"; | ||
|
||
describe("NextVerFeatures", () => { | ||
const impCfg: ImperativeConfig = ImperativeConfig.instance; | ||
|
||
beforeAll(() => { | ||
// impCfg.getCliCmdName is a getter of a property, so mock the property | ||
Object.defineProperty(impCfg, "envVariablePrefix", { | ||
configurable: true, | ||
get: jest.fn(() => { | ||
return "ZOWE"; | ||
}) | ||
}); | ||
}); | ||
|
||
describe("useV3ErrFormat", () => { | ||
|
||
it("should return false when environment variable is not set", () => { | ||
delete process.env.ZOWE_V3_ERR_FORMAT; | ||
expect(NextVerFeatures.useV3ErrFormat()).toBe(false); | ||
}); | ||
|
||
it("should return true when environment variable is set to lowercase true", () => { | ||
process.env.ZOWE_V3_ERR_FORMAT = "true"; | ||
expect(NextVerFeatures.useV3ErrFormat()).toBe(true); | ||
}); | ||
|
||
it("should return true when environment variable is set to uppercase TRUE", () => { | ||
process.env.ZOWE_V3_ERR_FORMAT = "TRUE"; | ||
expect(NextVerFeatures.useV3ErrFormat()).toBe(true); | ||
}); | ||
|
||
it("should return false when environment variable is set to a non-true value", () => { | ||
process.env.ZOWE_V3_ERR_FORMAT = "someGoofyValue"; | ||
expect(NextVerFeatures.useV3ErrFormat()).toBe(false); | ||
}); | ||
}); | ||
}); |