mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 20:59:30 +00:00
Added DatabaseConnectionPool.close()
This commit is contained in:
@@ -62,6 +62,13 @@ class DatabaseConnectionPool {
|
|||||||
await this.#connectionPool.execute(sql, params);
|
await this.#connectionPool.execute(sql, params);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the connection to the database
|
||||||
|
*/
|
||||||
|
async close() {
|
||||||
|
await this.#connectionPool.end();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = DatabaseConnectionPool;
|
module.exports = DatabaseConnectionPool;
|
||||||
|
|||||||
@@ -21,9 +21,14 @@ const mockRunQuery = jest.fn((sql, params) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const mockClose = jest.fn();
|
||||||
|
|
||||||
jest.mock('./DatabaseConnectionPool', () => {
|
jest.mock('./DatabaseConnectionPool', () => {
|
||||||
return jest.fn().mockImplementation(() => {
|
return jest.fn().mockImplementation(() => {
|
||||||
return { runQuery: mockRunQuery };
|
return {
|
||||||
|
runQuery: mockRunQuery,
|
||||||
|
close: mockClose
|
||||||
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user