Skip to content

Commit e31ab07

Browse files
committed
test: add unit test for runCommand with variable expansion in ILE
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
1 parent 4d66d17 commit e31ab07

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/api/tests/suites/connection.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Tools } from '../../Tools';
44
import { CONNECTION_TIMEOUT, disposeConnection, newConnection } from '../connection';
55
import IBMi from '../../IBMi';
66
import { getJavaHome } from '../../configuration/DebugConfiguration';
7+
import { CompileTools } from '../../CompileTools';
78

89
describe(`connection tests`, {concurrent: true}, () => {
910
let connection: IBMi
@@ -218,6 +219,25 @@ describe(`connection tests`, {concurrent: true}, () => {
218219
expect(qtempIndex < qsysincIndex).toBeTruthy();
219220
});
220221

222+
it('runCommand (ILE, variable expansion)', async () => { const config = connection.getConfig();
223+
224+
const result = await CompileTools.runCommand(connection,
225+
{
226+
command: `CRTDTAARA DTAARA(&SCOOBY/TEST) TYPE(*CHAR) LEN(10)`,
227+
environment: `ile`,
228+
env: {'&SCOOBY': `QTEMP`},
229+
},
230+
{
231+
commandConfirm: async (command) => {
232+
expect(command).toBe(`CRTDTAARA DTAARA(QTEMP/TEST) TYPE(*CHAR) LEN(10)`);
233+
return command;
234+
}
235+
}
236+
);
237+
238+
expect(result?.code).toBe(0);
239+
});
240+
221241
it('withTempDirectory and countFiles', async () => { const content = connection.getContent()!;
222242
let temp;
223243

0 commit comments

Comments
 (0)