Add e2e test for command help
This commit is contained in:
@@ -32,6 +32,21 @@ describe('builtin commands', () => {
|
||||
await expect(cli.exitCode()).resolves.toBe(0);
|
||||
};
|
||||
|
||||
/**
|
||||
* test for command help command returns expected info
|
||||
*/
|
||||
const commandHelpReturnsInfoDesc = 'command help returns info';
|
||||
const commandHelpCommand = ['help help'];
|
||||
const commandHelpReturnsInfo = async (cli: Cli) => {
|
||||
cli.run();
|
||||
await waitForExpect(async () => {
|
||||
const screen = cli.screen();
|
||||
expect(screen).toEqual(expect.arrayContaining([expect.stringContaining('OPTIONS')]));
|
||||
expect(screen).not.toEqual(expect.arrayContaining([expect.stringContaining('CURRENTLY UNAVAILABLE')]));
|
||||
});
|
||||
await expect(cli.exitCode()).resolves.toBe(0);
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
waitForExpect.defaults.timeout = waitForExpectDefaultTimeout;
|
||||
waitForExpect.defaults.interval = waitForExpectDefaultInterval;
|
||||
@@ -61,6 +76,18 @@ describe('builtin commands', () => {
|
||||
},
|
||||
testTimeout
|
||||
);
|
||||
|
||||
it(
|
||||
commandHelpReturnsInfoDesc,
|
||||
async () => {
|
||||
cli = new Cli({
|
||||
command: command,
|
||||
options: [...options, ...commandHelpCommand]
|
||||
});
|
||||
await commandHelpReturnsInfo(cli);
|
||||
},
|
||||
testTimeout
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -83,5 +110,17 @@ describe('builtin commands', () => {
|
||||
},
|
||||
testTimeout
|
||||
);
|
||||
|
||||
it(
|
||||
commandHelpReturnsInfoDesc,
|
||||
async () => {
|
||||
cli = new Cli({
|
||||
command: command,
|
||||
options: [...options, ...commandHelpCommand]
|
||||
});
|
||||
await commandHelpReturnsInfo(cli);
|
||||
},
|
||||
testTimeout
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user