next test + test reporting

This commit is contained in:
Jan Prochazka
2021-05-28 15:10:02 +02:00
parent 188c2b7a9c
commit b85334cb2d
3 changed files with 23 additions and 2 deletions

View File

@@ -25,6 +25,10 @@ jobs:
cd integration-tests cd integration-tests
yarn wait:ci yarn wait:ci
yarn test:ci yarn test:ci
- uses: tanmen/jest-reporter@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-file: integration-tests/result.json
services: services:
postgres: postgres:

View File

@@ -88,7 +88,7 @@ describe('Query', () => {
); );
test.each(engines.map(engine => [engine.label, engine]))( test.each(engines.map(engine => [engine.label, engine]))(
'Combined query - %s', 'More queries - %s',
testWrapper(async (conn, driver, engine) => { testWrapper(async (conn, driver, engine) => {
for (const sql of initSql) await driver.query(conn, sql); for (const sql of initSql) await driver.query(conn, sql);
const results = await executeStream( const results = await executeStream(
@@ -107,4 +107,21 @@ describe('Query', () => {
expect(res2.rows).toEqual([expect.dataRow({ id: 2 }), expect.dataRow({ id: 1 })]); expect(res2.rows).toEqual([expect.dataRow({ id: 2 }), expect.dataRow({ id: 1 })]);
}) })
); );
test.each(engines.map(engine => [engine.label, engine]))(
'Script - %s',
testWrapper(async (conn, driver, engine) => {
const results = await executeStream(
driver,
conn,
'CREATE TABLE t1 (id int); INSERT INTO t1 (id) VALUES (1); INSERT INTO t1 (id) VALUES (2); SELECT id FROM t1 ORDER BY id; '
);
expect(results.length).toEqual(1);
const res1 = results[0];
expect(res1.columns).toEqual([expect.objectContaining({ columnName: 'id' })]);
expect(res1.rows).toEqual([expect.dataRow({ id: 1 }), expect.dataRow({ id: 2 })]);
})
);
}); });

View File

@@ -13,7 +13,7 @@
"wait:ci": "cross-env DEVMODE=1 CITEST=1 node wait.js", "wait:ci": "cross-env DEVMODE=1 CITEST=1 node wait.js",
"test:local": "cross-env DEVMODE=1 LOCALTEST=1 jest", "test:local": "cross-env DEVMODE=1 LOCALTEST=1 jest",
"test:ci": "cross-env DEVMODE=1 CITEST=1 jest --runInBand", "test:ci": "cross-env DEVMODE=1 CITEST=1 jest --runInBand --json --outputFile=result.json --testLocationInResults",
"run:local": "docker-compose down && docker-compose up -d && yarn wait:local && yarn test:local" "run:local": "docker-compose down && docker-compose up -d && yarn wait:local && yarn test:local"
}, },