1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 19:59:27 +00:00

Fix bug where trailing whitespace in sql query after ; would error

This commit is contained in:
2022-01-20 17:57:01 +00:00
parent 5854c3928a
commit ec3890fa7f
3 changed files with 17 additions and 2 deletions

View File

@@ -3,8 +3,10 @@
const DatabaseConnectionPool = require('./DatabaseConnectionPool');
const mockRunQuery = jest.fn((sql, params) => {
sql = sql.trim();
if (sql.slice(-1) !== ';')
throw new Error('Invalid query, needs ;');
throw new Error('Invalid query, needs trailing ;');
// Execute as non-prepared if no params are supplied
if (typeof params === 'undefined') {