Test help command with e2e tests

- Backport #756
- Fixes #759
This commit is contained in:
Janne Valkealahti
2023-06-02 06:19:12 +01:00
parent 08b16d5290
commit 7768d46360

View File

@@ -47,6 +47,20 @@ describe('builtin commands', () => {
await expect(cli.exitCode()).resolves.toBe(0);
};
/**
* test for command help succeed
*/
const helpReturnsInfoDesc = 'command help returns info';
const helpCommand = ['help'];
const helpReturnsInfo = async (cli: Cli) => {
cli.run();
await waitForExpect(async () => {
const screen = cli.screen();
expect(screen).toEqual(expect.arrayContaining([expect.stringContaining('AVAILABLE COMMANDS')]));
});
await expect(cli.exitCode()).resolves.toBe(0);
};
beforeEach(async () => {
waitForExpect.defaults.timeout = waitForExpectDefaultTimeout;
waitForExpect.defaults.interval = waitForExpectDefaultInterval;
@@ -88,6 +102,18 @@ describe('builtin commands', () => {
},
testTimeout
);
it(
helpReturnsInfoDesc,
async () => {
cli = new Cli({
command: command,
options: [...options, ...helpCommand]
});
await helpReturnsInfo(cli);
},
testTimeout
);
});
/**
@@ -122,5 +148,17 @@ describe('builtin commands', () => {
},
testTimeout
);
it(
helpReturnsInfoDesc,
async () => {
cli = new Cli({
command: command,
options: [...options, ...helpCommand]
});
await helpReturnsInfo(cli);
},
testTimeout
);
});
});