create table test

This commit is contained in:
Jan Prochazka
2021-09-05 08:42:56 +02:00
parent f4c39bbf3c
commit 5b58ed9c26
4 changed files with 58 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
global.DBGATE_TOOLS = require('dbgate-tools');
const requireEngineDriver = require('dbgate-api/src/utility/requireEngineDriver');
const crypto = require('crypto');
const fp = require('lodash/fp');
function randomDbName() {
const generatedKey = crypto.randomBytes(6);
@@ -55,9 +56,22 @@ const testWrapper = body => async (label, ...other) => {
}
};
function pickImportantTableInfo(table) {
return {
pureName: table.pureName,
columns: table.columns.map(fp.pick(['columnName', 'notNull', 'autoIncrement'])),
};
}
function checkTableStructure(t1, t2) {
// expect(t1.pureName).toEqual(t2.pureName)
expect(pickImportantTableInfo(t1)).toEqual(pickImportantTableInfo(t2));
}
module.exports = {
randomDbName,
connect,
extractConnection,
testWrapper,
checkTableStructure,
};