integration tests WIP

This commit is contained in:
Jan Prochazka
2021-05-27 09:26:37 +02:00
parent 0413075af6
commit 54fec7fd6d
7 changed files with 74 additions and 19 deletions

View File

@@ -25,7 +25,7 @@ async function connect(connection, database) {
describe('Analyse tests', () => {
test.each(engines.map(engine => [engine.label, engine.connection]))(
'Create table (%s)',
'Table - full analysis (%s)',
async (label, connection) => {
const conn = await connect(connection, randomDbName());
const driver = requireEngineDriver(connection);
@@ -48,4 +48,30 @@ describe('Analyse tests', () => {
await driver.close(conn);
}
);
test.each(engines.map(engine => [engine.label, engine.connection]))(
'Table add - incremental analysis (%s)',
async (label, connection) => {
const conn = await connect(connection, randomDbName());
const driver = requireEngineDriver(connection);
await driver.query(conn, 'CREATE TABLE t1 (id int)');
const structure1 = await driver.analyseFull(conn);
await driver.query(conn, 'CREATE TABLE t2 (id2 int)');
const structure2 = await driver.analyseIncremental(conn, structure1);
expect(structure2.tables.length).toEqual(2);
expect(structure2.tables.find(x => x.pureName == 't2')).toEqual(
expect.objectContaining({
pureName: 't2',
columns: [
expect.objectContaining({
columnName: 'id2',
}),
],
})
);
await driver.close(conn);
}
);
});