diff --git a/features/step_definitions/routability.js b/features/step_definitions/routability.js index a93ee29bb..0f1117c2a 100644 --- a/features/step_definitions/routability.js +++ b/features/step_definitions/routability.js @@ -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) => { diff --git a/features/support/build_osm.js b/features/support/build_osm.js index bac21d189..7fe6874ae 100644 --- a/features/support/build_osm.js +++ b/features/support/build_osm.js @@ -44,8 +44,8 @@ class DB { uid: n.OSM_UID, user: n.OSM_USER, timestamp: n.OSM_TIMESTAMP, - lon: n.lon, - lat: n.lat + lon: ensureDecimal(n.lon), + lat: ensureDecimal(n.lat) }); for (var k in n.tags) { @@ -109,8 +109,8 @@ class Node { this.OSM_USER = OSM_USER; this.OSM_TIMESTAMP = OSM_TIMESTAMP; this.OSM_UID = OSM_UID; - this.lon = ensureDecimal(lon); - this.lat = ensureDecimal(lat); + this.lon = lon; + this.lat = lat; this.tags = tags; } diff --git a/features/support/data.js b/features/support/data.js index abef54c9b..bf5e75db0 100644 --- a/features/support/data.js +++ b/features/support/data.js @@ -151,7 +151,6 @@ module.exports = function () { }; this.writeOSM = (callback) => { - fs.exists(this.DATA_FOLDER, (exists) => { var mkDirFn = exists ? (cb) => { cb(); } : fs.mkdir.bind(fs.mkdir, this.DATA_FOLDER); mkDirFn((err) => { @@ -329,7 +328,7 @@ module.exports = function () { this.processRowsAndDiff = (table, fn, callback) => { var q = d3.queue(1); - table.hashes().forEach((row, i) => q.defer(fn, row, i)); + table.hashes().forEach((row, i) => { q.defer(fn, row, i); }); q.awaitAll((err, actual) => { if (err) return callback(err); diff --git a/features/support/launch_classes.js b/features/support/launch_classes.js index 6a616fe2a..c50437d49 100644 --- a/features/support/launch_classes.js +++ b/features/support/launch_classes.js @@ -20,7 +20,7 @@ var OSRMBaseLoader = class { }); }; - runLaunch(limit((e) => { if (e) callback(e); callback(); })); + runLaunch(limit((e) => { if (e) callback(e); else callback(); })); } shutdown (callback) { @@ -30,7 +30,7 @@ var OSRMBaseLoader = class { this.osrmDown(cb); }; - runShutdown(limit((e) => { if (e) callback(e); callback(); })); + runShutdown(limit((e) => { if (e) callback(e); else callback(); })); } osrmIsRunning () { @@ -62,7 +62,7 @@ var OSRMBaseLoader = class { waitForShutdown (callback) { var check = () => { - if (!this.osrmIsRunning()) callback(); + if (!this.osrmIsRunning()) return callback(); }; setTimeout(check, 100); }