more testing

This commit is contained in:
Dave Horton
2020-01-25 15:51:47 -05:00
parent 12d49a40a4
commit 0df1e44f15
9 changed files with 79 additions and 49 deletions

View File

@@ -2,7 +2,6 @@ const Emitter = require('events');
const debug = require('debug')('jambonz:feature-server');
const assert = require('assert');
const {TaskPreconditions} = require('../utils/constants');
const hooks = require('../utils/notifiers');
const specs = new Map();
const _specData = require('./specs');
for (const key in _specData) {specs.set(key, _specData[key]);}
@@ -28,7 +27,9 @@ class Task extends Emitter {
async exec(cs) {
this.cs = cs;
const {actionHook, notifyHook} = hooks(this.logger, cs.callInfo);
// N.B. need to require it down here rather than at top to avoid recursion in require of this module
const {actionHook, notifyHook} = require('../utils/notifiers')(this.logger, cs.callInfo);
this.actionHook = actionHook;
this.notifyHook = notifyHook;
}
@@ -55,7 +56,7 @@ class Task extends Emitter {
if (this.action) {
const tasks = await this.actionHook(this.action, method, auth, results);
if (tasks && Array.isArray(tasks)) {
this.logger.debug(`${this.name} replacing application with ${tasks.length} tasks`);
this.logger.debug({tasks: tasks}, `${this.name} replacing application with ${tasks.length} tasks`);
this.callSession.replaceApplication(tasks);
}
}