Fix #343, add the poss^Cility to use the test backend (WIP), improve testability of OsmConnection (WIP)
This commit is contained in:
parent
8d404b1ba9
commit
9458128ccf
7 changed files with 138 additions and 42 deletions
46
test/OsmConnection.spec.ts
Normal file
46
test/OsmConnection.spec.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import T from "./TestHelper";
|
||||
import UserDetails, {OsmConnection} from "../Logic/Osm/OsmConnection";
|
||||
import {UIEventSource} from "../Logic/UIEventSource";
|
||||
import ScriptUtils from "../scripts/ScriptUtils";
|
||||
|
||||
|
||||
export default class OsmConnectionSpec extends T {
|
||||
|
||||
/*
|
||||
This token gives access to the TESTING-instance of OSM. No real harm can be done with it, so it can be commited to the repo
|
||||
*/
|
||||
private static _osm_token = "LJFmv2nUicSNmBNsFeyCHx5KKx6Aiesx8pXPbX4n"
|
||||
|
||||
constructor() {
|
||||
super("OsmConnectionSpec-test", [
|
||||
["login on dev",
|
||||
() => {
|
||||
const osmConn = new OsmConnection(false,
|
||||
new UIEventSource<string>(undefined),
|
||||
"Unit test",
|
||||
true,
|
||||
"osm-test"
|
||||
)
|
||||
|
||||
osmConn.userDetails.map((userdetails : UserDetails) => {
|
||||
if(userdetails.loggedIn){
|
||||
console.log("Logged in with the testing account. Writing some random data to test preferences")
|
||||
const data = Math.random().toString()
|
||||
osmConn.GetPreference("test").setData(data)
|
||||
|
||||
osmConn.GetPreference("https://raw.githubusercontent.com/AgusQui/MapCompleteRailway/main/railway")
|
||||
.setData(data)
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ScriptUtils.sleep(1000)
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue