Fixes: double callbacks and untested headers

This commit is contained in:
Lauren Budorick
2016-03-28 15:39:57 -07:00
committed by Patrick Niklaus
parent 25e40d723a
commit 908e3a2af6
4 changed files with 14 additions and 13 deletions
+6 -4
View File
@@ -5,18 +5,20 @@ var classes = require('../support/data_classes');
module.exports = function () {
this.Then(/^routability should be$/, (table, callback) => {
this.buildWaysFromTable(table, () => {
var directions = ['forw','backw','bothw'];
var directions = ['forw','backw','bothw'],
headers = new Set(Object.keys(table.hashes()[0]));
if (!directions.some(k => !!table.hashes()[0].hasOwnProperty(k))) {
if (!directions.some(k => !!headers.has(k))) {
throw new Error('*** routability table must contain either "forw", "backw" or "bothw" column');
}
this.reprocessAndLoadData(() => {
var testRow = (row, i, cb) => {
var outputRow = row;
testRoutabilityRow(i, (err, result) => {
if (err) return cb(err);
directions.filter(d => !!table.hashes()[0][d]).forEach((direction) => {
directions.filter(d => headers.has(d)).forEach((direction) => {
var want = this.shortcutsHash[row[direction]] || row[direction];
switch (true) {
@@ -83,7 +85,7 @@ module.exports = function () {
});
};
d3.queue()
d3.queue(1)
.defer(testDirection, 'forw')
.defer(testDirection, 'backw')
.awaitAll((err, res) => {