Skip to content

Commit

Permalink
add force exist jest
Browse files Browse the repository at this point in the history
  • Loading branch information
invisal committed Dec 18, 2024
1 parent 1484f6b commit 3c31643
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"prepack": "npm run build",
"prepare": "husky install",
"test": "jest --verbose --testPathPattern=unit",
"test:connection": "jest --verbose --testPathPattern=connection --runInBand",
"test:connection": "jest --verbose --testPathPattern=connection --runInBand --forceExit",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage --testPathPattern=unit"
},
Expand Down
38 changes: 19 additions & 19 deletions src/connections/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ export function buildMySQLDatabaseSchmea({

columnLookup[
column.TABLE_SCHEMA +
'.' +
column.TABLE_NAME +
'.' +
column.COLUMN_NAME
'.' +
column.TABLE_NAME +
'.' +
column.COLUMN_NAME
] = columnObject;

table.columns.push(columnObject);
Expand All @@ -156,10 +156,10 @@ export function buildMySQLDatabaseSchmea({

constraintLookup[
constraint.TABLE_SCHEMA +
'.' +
constraint.TABLE_NAME +
'.' +
constraint.CONSTRAINT_NAME
'.' +
constraint.TABLE_NAME +
'.' +
constraint.CONSTRAINT_NAME
] = constraintObject;

table.constraints.push(constraintObject);
Expand All @@ -169,22 +169,22 @@ export function buildMySQLDatabaseSchmea({
for (const constraintColumn of constraintColumnsList) {
const constraint =
constraintLookup[
constraintColumn.TABLE_SCHEMA +
'.' +
constraintColumn.TABLE_NAME +
'.' +
constraintColumn.CONSTRAINT_NAME
constraintColumn.TABLE_SCHEMA +
'.' +
constraintColumn.TABLE_NAME +
'.' +
constraintColumn.CONSTRAINT_NAME
];

if (!constraint) continue;

const currentColumn =
columnLookup[
constraintColumn.TABLE_SCHEMA +
'.' +
constraintColumn.TABLE_NAME +
'.' +
constraintColumn.COLUMN_NAME
constraintColumn.TABLE_SCHEMA +
'.' +
constraintColumn.TABLE_NAME +
'.' +
constraintColumn.COLUMN_NAME
];
if (currentColumn && constraintColumn.REFERENCED_COLUMN_NAME) {
currentColumn.definition.references = {
Expand Down Expand Up @@ -377,7 +377,7 @@ export class MySQLConnection extends SqlConnection {
);
}

async connect(): Promise<any> {}
async connect(): Promise<any> { }
async disconnect(): Promise<any> {
this.conn.destroy();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/connections/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ beforeAll(async () => {

// Clean up all tables
const schemaList = await db.fetchDatabaseSchema();
const currentSchema = schemaList[DEFAULT_SCHEMA];
const currentSchema = schemaList[DEFAULT_SCHEMA] ?? {};

for (const table of Object.values(currentSchema)) {
await db.dropTable(DEFAULT_SCHEMA, table.name)
Expand Down
2 changes: 2 additions & 0 deletions tests/connections/postgres.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import createTestClient from './create-test-connection';
const { client: db, defaultSchema: DEFAULT_SCHEMA } = createTestClient();

beforeAll(async () => {
if (process.env.CONNECTION_TYPE !== 'postgres') return;
await db.connect();
});

afterAll(async () => {
if (process.env.CONNECTION_TYPE !== 'postgres') return;
await db.disconnect();
});

Expand Down

0 comments on commit 3c31643

Please sign in to comment.