downport and unit tests (#12)

* refactor tests

* additional unit tests, closes #10

* refactor

* better error messages

* add downport step, closes #9

* test
This commit is contained in:
Lars Hvam
2021-11-25 18:23:15 +01:00
committed by GitHub
parent 94a1e2392c
commit e088e2de27
15 changed files with 224 additions and 68 deletions

View File

@@ -20,40 +20,40 @@ function checkExpected(expectedFile: string): void {
expect(act).to.equal(exp);
}
function test(slug: string, expectedStatus: string) {
const path = join(fixtures, slug);
const res = spawnSync('bash', [run, slug, path, output], {cwd: root});
expect(res.status).to.equal(0);
checkExpected(join(path, "expected_results.json"));
expect(readResult().status).to.equal(expectedStatus);
}
describe('abap-test-runner', async () => {
it('simple, pass', async () => {
const slug = "simple-pass";
const path = join(fixtures, slug);
const res = spawnSync('bash', [run, slug, path, output], {cwd: root});
expect(res.status).to.equal(0);
expect(readResult().status).to.equal("pass");
checkExpected(join(path, "expected_results.json"));
test("simple-pass", "pass");
});
it('simple, fail', async () => {
const slug = "simple-fail";
const path = join(fixtures, slug);
const res = spawnSync('bash', [run, slug, path, output], {cwd: root});
expect(res.status).to.equal(0);
expect(readResult().status).to.equal("fail");
checkExpected(join(path, "expected_results.json"));
it('simple-fail', async () => {
test("simple-fail", "fail");
});
it('simple, syntax error', async () => {
const slug = "simple-error";
const path = join(fixtures, slug);
const res = spawnSync('bash', [run, slug, path, output], {cwd: root});
expect(res.status).to.equal(0);
expect(readResult().status).to.equal("error");
checkExpected(join(path, "expected_results.json"));
it('simple-error', async () => {
test("simple-error", "error");
});
it('hello-world, pass', async () => {
const slug = "hello-world-pass";
const path = join(fixtures, slug);
const res = spawnSync('bash', [run, slug, path, output], {cwd: root});
expect(res.status).to.equal(0);
expect(readResult().status).to.equal("pass");
checkExpected(join(path, "expected_results.json"));
it('hello-world-pass', async () => {
test("hello-world-pass", "pass");
});
it('simple-all-fail', async () => {
test("simple-all-fail", "fail");
});
it('simple-some-fail', async () => {
test("simple-some-fail", "fail");
});
it('simple-downport-pass', async () => {
test("simple-downport-pass", "pass");
});
});