More work on splitting roads, WIP; refactoring tests

This commit is contained in:
Pieter Vander Vennet 2021-09-22 05:02:09 +02:00
parent e374bb355c
commit 1f93923820
62 changed files with 1163 additions and 823 deletions

View file

@ -1,27 +1,26 @@
import T from "./TestHelper";
import {OsmObject} from "../Logic/Osm/OsmObject";
import ScriptUtils from "../scripts/ScriptUtils";
import {UIEventSource} from "../Logic/UIEventSource";
export default class OsmObjectSpec extends T {
private static async runTest(){
const ways = await OsmObject.DownloadReferencingWays("node/1124134958")
if(ways === undefined){
throw "Did not get the ways"
}
if (ways.length !== 4) {
throw "Expected 4 ways but got "+ways.length
}
}
constructor() {
super("OsmObject", [
super("osmobject", [
[
"Download referencing ways",
() => {
let downloaded = false;
OsmObject.DownloadReferencingWays("node/1124134958").addCallbackAndRunD(ways => {
downloaded = true;
console.log(ways)
})
let timeout = 10
while (!downloaded && timeout >= 0) {
ScriptUtils.sleep(1000)
timeout--;
}
if (!downloaded) {
throw "Timeout: referencing ways not found"
}
OsmObjectSpec.runTest().then(_ => console.log("Referencing ways test is done (async)"))
}
]