Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Command handler unit tests require a lot of mocks #1906

Open
t1m0thyj opened this issue Jan 18, 2022 · 1 comment
Open

[v2] Command handler unit tests require a lot of mocks #1906

t1m0thyj opened this issue Jan 18, 2022 · 1 comment
Labels
enhancement New feature or request priority-low Legit issue but cosmetic or nice-to-have testing

Comments

@t1m0thyj
Copy link
Member

In a unit test that calls ICommandHandler.process and mocks an ImperativeConfig.instance.config object with the exists: true property defined, several mocks are required which may be an inconvenience for plug-in developers.

For an example, see this sample plug-in unit test: zowe/zowe-cli-sample-plugin@a6b6d22#diff-c5dfd517fddad71ab1fe78c762be9a365f981aa118a4b3a72427717d679d634c

The following functions require mocks to be defined on the ImperativeConfig instance:

  • LoggerUtils.censorRawData - envVariablePrefix, config.api.layers.get, config.api.secure.secureFields
  • ConfigAutoStore.findActiveProfile - loadedConfig.profiles
@MarkAckert MarkAckert added the priority-low Legit issue but cosmetic or nice-to-have label Feb 3, 2023
@zFernand0 zFernand0 added the enhancement New feature or request label Mar 6, 2023
@awharn awharn transferred this issue from zowe/imperative Nov 13, 2023
@zFernand0
Copy link
Member

After a short discussion, we wanted to reduce code duplication.
This might be a good enhancement for the cli-test-utils package.
We could add a few clever ways to mock these methods 😋
(not a good first issue 😅 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-low Legit issue but cosmetic or nice-to-have testing
Projects
Status: Low Priority
Development

No branches or pull requests

3 participants