Skip to content

Instantly share code, notes, and snippets.

@dkelosky
Last active January 23, 2019 13:17
Show Gist options
  • Save dkelosky/a9249a68fb778d9eb79343f911b46738 to your computer and use it in GitHub Desktop.
Save dkelosky/a9249a68fb778d9eb79343f911b46738 to your computer and use it in GitHub Desktop.
import { execSync } from "child_process";
import * as config from "config";
import * as fs from "fs";
import * as handlebars from "handlebars";
const TIMEOUT = 20000;
const test = [{
in: "hello world"
},
{
in: "good bye world"
}];
(config as any).test = test;
let buildResponse: any;
let testResponse: any;
describe("AMS tests", () => {
beforeAll(() => {
// build and run jcl to compile and bind all source
const gen = execSync(`npm run genjcl:build`);
console.log(gen.toString());
let cmd = "zowe jobs submit lf \"./build/custom.jcl\" --directory \"./output\" --rfj"
buildResponse = JSON.parse(execSync(cmd).toString());
// build and run jcl to test service
const jcl = fs.readFileSync("./zossrc/jcl/amstest.jcl").toString();
const compiled = handlebars.compile(jcl);
const rendered = compiled(config);
if (!fs.existsSync("./build")) fs.mkdirSync("./build");
fs.writeFileSync("./build/amstest.jcl", rendered);
console.log("Generated custom JCL to ./build/amstest.jcl");
cmd = "zowe jobs submit lf \"./build/amstest.jcl\" --directory \"./output\" --rfj"
testResponse = JSON.parse(execSync(cmd).toString());
}, TIMEOUT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment