Skip to content

Commit

Permalink
test: add unit test for runCommand with variable expansion in ILE
Browse files Browse the repository at this point in the history
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
  • Loading branch information
worksofliam committed Jan 25, 2025
1 parent 4d66d17 commit e31ab07
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/api/tests/suites/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Tools } from '../../Tools';
import { CONNECTION_TIMEOUT, disposeConnection, newConnection } from '../connection';
import IBMi from '../../IBMi';
import { getJavaHome } from '../../configuration/DebugConfiguration';
import { CompileTools } from '../../CompileTools';

describe(`connection tests`, {concurrent: true}, () => {
let connection: IBMi
Expand Down Expand Up @@ -218,6 +219,25 @@ describe(`connection tests`, {concurrent: true}, () => {
expect(qtempIndex < qsysincIndex).toBeTruthy();
});

it('runCommand (ILE, variable expansion)', async () => { const config = connection.getConfig();

const result = await CompileTools.runCommand(connection,
{
command: `CRTDTAARA DTAARA(&SCOOBY/TEST) TYPE(*CHAR) LEN(10)`,
environment: `ile`,
env: {'&SCOOBY': `QTEMP`},
},
{
commandConfirm: async (command) => {
expect(command).toBe(`CRTDTAARA DTAARA(QTEMP/TEST) TYPE(*CHAR) LEN(10)`);
return command;
}
}
);

expect(result?.code).toBe(0);
});

it('withTempDirectory and countFiles', async () => { const content = connection.getContent()!;
let temp;

Expand Down

0 comments on commit e31ab07

Please sign in to comment.