mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-10-04 02:04:18 +00:00
add integration test
This commit is contained in:
@@ -2,6 +2,7 @@ const mysql = require('mysql2');
|
||||
const pool = mysql.createPool({
|
||||
host: process.env.JAMBONES_MYSQL_HOST,
|
||||
user: process.env.JAMBONES_MYSQL_USER,
|
||||
port: process.env.JAMBONES_MYSQL_PORT || 3306,
|
||||
password: process.env.JAMBONES_MYSQL_PASSWORD,
|
||||
database: process.env.JAMBONES_MYSQL_DATABASE,
|
||||
connectionLimit: process.env.JAMBONES_MYSQL_CONNECTION_LIMIT || 10
|
||||
|
||||
@@ -43,6 +43,7 @@ function validateUpdateCall(opts) {
|
||||
const hasWhisper = opts.whisper;
|
||||
const count = [
|
||||
'call_hook',
|
||||
'child_call_hook',
|
||||
'call_status',
|
||||
'listen_status',
|
||||
'mute_status']
|
||||
@@ -56,11 +57,13 @@ function validateUpdateCall(opts) {
|
||||
case 1:
|
||||
// good
|
||||
break;
|
||||
case 2:
|
||||
if (opts.call_hook && opts.child_call_hook) break;
|
||||
// eslint-disable-next-line no-fallthrough
|
||||
default:
|
||||
throw new DbErrorBadRequest('multiple options are not allowed in updateCall');
|
||||
}
|
||||
|
||||
if (opts.call_hook && !opts.call_hook.url) throw new DbErrorBadRequest('missing call_hook.url');
|
||||
if (opts.call_status && !['completed', 'no-answer'].includes(opts.call_status)) {
|
||||
throw new DbErrorBadRequest('invalid call_status');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user