Skip to content

Commit f2a48a0

Browse files
committed
Test help command with e2e tests
- Fixes #756
1 parent af34526 commit f2a48a0

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ describe('builtin commands', () => {
4747
await expect(cli.exitCode()).resolves.toBe(0);
4848
};
4949

50+
/**
51+
* test for command help succeed
52+
*/
53+
const helpReturnsInfoDesc = 'command help returns info';
54+
const helpCommand = ['help'];
55+
const helpReturnsInfo = async (cli: Cli) => {
56+
cli.run();
57+
await waitForExpect(async () => {
58+
const screen = cli.screen();
59+
expect(screen).toEqual(expect.arrayContaining([expect.stringContaining('AVAILABLE COMMANDS')]));
60+
});
61+
await expect(cli.exitCode()).resolves.toBe(0);
62+
};
63+
5064
beforeEach(async () => {
5165
waitForExpect.defaults.timeout = waitForExpectDefaultTimeout;
5266
waitForExpect.defaults.interval = waitForExpectDefaultInterval;
@@ -88,6 +102,18 @@ describe('builtin commands', () => {
88102
},
89103
testTimeout
90104
);
105+
106+
it(
107+
helpReturnsInfoDesc,
108+
async () => {
109+
cli = new Cli({
110+
command: command,
111+
options: [...options, ...helpCommand]
112+
});
113+
await helpReturnsInfo(cli);
114+
},
115+
testTimeout
116+
);
91117
});
92118

93119
/**
@@ -122,5 +148,17 @@ describe('builtin commands', () => {
122148
},
123149
testTimeout
124150
);
151+
152+
it(
153+
helpReturnsInfoDesc,
154+
async () => {
155+
cli = new Cli({
156+
command: command,
157+
options: [...options, ...helpCommand]
158+
});
159+
await helpReturnsInfo(cli);
160+
},
161+
testTimeout
162+
);
125163
});
126164
});

0 commit comments

Comments
 (0)