Skip to content

Commit

Permalink
fix(kadena-cli): add warning message for not deploying faucet + updat…
Browse files Browse the repository at this point in the history
…e test case descriptions (#2158)
  • Loading branch information
realdreamer committed May 28, 2024
1 parent e26cc1f commit f385a62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-suns-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kadena/kadena-cli": minor
---

Add warning log message when user selects "no" for deploying the faucet.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export const createAccountFundCommand = createCommand(
const { deployFaucet } = await option.deployFaucet();

if (deployFaucet === false) {
return;
return log.warning(
`To fund your account on chain "${undeployedChainIdsStr}" in the "${networkConfig.network}" network, deploy the faucet using the --deploy-faucet option.`,
);
}

const loader = ora(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ describe('account fund', () => {
mockCheckHealth.mockRestore();
});

it('should exit and not fund when user select no for deploy faucet prompt', async () => {
it('should exit without funding when user select "no" for deploy faucet prompt', async () => {
mockPrompts({
select: {
'Do you wish to deploy faucet module?': 'no',
Expand All @@ -197,6 +197,9 @@ describe('account fund', () => {
'Faucet module unavailable on chain "1" in the "devnet" network.',
);
expect(mockdeployFaucetsToChains).not.toHaveBeenCalled();
expect(res.stderr).toContain(
'To fund your account on chain "1" in the "devnet" network, deploy the faucet using the --deploy-faucet option.',
);
expect(res.stderr).not.toContain(
'Account "accountName" funded with 5 coin(s) on Chain ID(s) "1" in development network.',
);
Expand All @@ -205,7 +208,7 @@ describe('account fund', () => {
mockdeployFaucetsToChains.mockRestore();
});

it('should deploy faucets when user select yes to deploy faucet', async () => {
it('should deploy faucet and fund account when user select "yes" to deploy faucet', async () => {
mockPrompts({
select: {
'Do you wish to deploy faucet module?': 'yes',
Expand Down

0 comments on commit f385a62

Please sign in to comment.