Skip to content

Commit 341a69e

Browse files
committed
Add e2e test for command help
1 parent eb2d351 commit 341a69e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

e2e/spring-shell-e2e-tests/test/builtin.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ describe('builtin commands', () => {
3232
await expect(cli.exitCode()).resolves.toBe(0);
3333
};
3434

35+
/**
36+
* test for command help command returns expected info
37+
*/
38+
const commandHelpReturnsInfoDesc = 'command help returns info';
39+
const commandHelpCommand = ['help help'];
40+
const commandHelpReturnsInfo = async (cli: Cli) => {
41+
cli.run();
42+
await waitForExpect(async () => {
43+
const screen = cli.screen();
44+
expect(screen).toEqual(expect.arrayContaining([expect.stringContaining('OPTIONS')]));
45+
expect(screen).not.toEqual(expect.arrayContaining([expect.stringContaining('CURRENTLY UNAVAILABLE')]));
46+
});
47+
await expect(cli.exitCode()).resolves.toBe(0);
48+
};
49+
3550
beforeEach(async () => {
3651
waitForExpect.defaults.timeout = waitForExpectDefaultTimeout;
3752
waitForExpect.defaults.interval = waitForExpectDefaultInterval;
@@ -61,6 +76,18 @@ describe('builtin commands', () => {
6176
},
6277
testTimeout
6378
);
79+
80+
it(
81+
commandHelpReturnsInfoDesc,
82+
async () => {
83+
cli = new Cli({
84+
command: command,
85+
options: [...options, ...commandHelpCommand]
86+
});
87+
await commandHelpReturnsInfo(cli);
88+
},
89+
testTimeout
90+
);
6491
});
6592

6693
/**
@@ -83,5 +110,17 @@ describe('builtin commands', () => {
83110
},
84111
testTimeout
85112
);
113+
114+
it(
115+
commandHelpReturnsInfoDesc,
116+
async () => {
117+
cli = new Cli({
118+
command: command,
119+
options: [...options, ...commandHelpCommand]
120+
});
121+
await commandHelpReturnsInfo(cli);
122+
},
123+
testTimeout
124+
);
86125
});
87126
});

0 commit comments

Comments
 (0)