Fix #343, add the poss^Cility to use the test backend (WIP), improve testability of OsmConnection (WIP)

This commit is contained in:
Pieter Vander Vennet 2021-06-08 16:52:31 +02:00
parent 8d404b1ba9
commit 9458128ccf
7 changed files with 138 additions and 42 deletions

View file

@ -98,6 +98,7 @@ export default class State {
public readonly featureSwitchIsTesting: UIEventSource<boolean>;
public readonly featureSwitchIsDebugging: UIEventSource<boolean>;
public readonly featureSwitchShowAllQuestions: UIEventSource<boolean>;
public readonly featureSwitchApiURL: UIEventSource<string>;
/**
@ -201,7 +202,6 @@ export default class State {
this.featureSwitchShowAllQuestions = featSw("fs-all-questions", (layoutToUse) => layoutToUse?.enableShowAllQuestions ?? false,
"Always show all questions");
this.featureSwitchIsTesting = QueryParameters.GetQueryParameter("test", "false",
"If true, 'dryrun' mode is activated. The app will behave as normal, except that changes to OSM will be printed onto the console instead of actually uploaded to osm.org")
.map(str => str === "true", [], b => "" + b);
@ -209,6 +209,10 @@ export default class State {
this.featureSwitchIsDebugging = QueryParameters.GetQueryParameter("debug","false",
"If true, shows some extra debugging help such as all the available tags on every object")
.map(str => str === "true", [], b => "" + b)
this.featureSwitchApiURL = QueryParameters.GetQueryParameter("backend","https://openstreetmap.org",
"The OSM backend to use - can be used to redirect mapcomplete to a testing backend or e.g. openHistoricalMap")
}
@ -217,7 +221,9 @@ export default class State {
QueryParameters.GetQueryParameter("oauth_token", undefined,
"Used to complete the login"),
layoutToUse?.id,
true
true,
// @ts-ignore
this.featureSwitchApiURL.data
);