commit 77f1fcadb53dc04c589750b5b84015cc474eb65f
parent 10a6622b669c52dec6423a70345da3e5d9c9bb59
Author: Sergey Orlov <wladimirych@gmail.com>
Date: Tue, 29 Jun 2021 16:50:28 +0200
tracks: add tests for loading tracks from Wikiloc
Related to #252
Diffstat:
4 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/test/test_track_load.js b/test/test_track_load.js
@@ -74,6 +74,9 @@ suite('Load tracks from services');
// 'openstreetmapRu',
// 'openstreetmapRuGpx',
// 'openstreetmapRu_not_exists',
+ 'wikiloc_not_exists',
+ 'wikiloc_with_waypoints',
+ 'wikiloc',
].forEach(function (testcase) {
// eslint-disable-next-line import/no-dynamic-require
const testData = require('./track_load_data/testcases/' + testcase + '.json');
diff --git a/test/track_load_data/testcases/wikiloc.json b/test/track_load_data/testcases/wikiloc.json
@@ -0,0 +1,22 @@
+{
+ "query": [
+ "https://www.wikiloc.com/hiking-trails/test2-77023309"
+ ],
+ "geodata": [
+ {
+ "name": "Test2",
+ "tracks": [
+ [
+ {"lat": 56.526946, "lng": 28.962483},
+ {"lat": 56.526960, "lng": 28.962478},
+ {"lat": 56.527011, "lng": 28.962450},
+ {"lat": 56.527021, "lng": 28.962496},
+ {"lat": 56.527013, "lng": 28.962502},
+ {"lat": 56.527002, "lng": 28.962494},
+ {"lat": 56.527019, "lng": 28.962526}
+ ]
+ ],
+ "points": []
+ }
+ ]
+}
diff --git a/test/track_load_data/testcases/wikiloc_not_exists.json b/test/track_load_data/testcases/wikiloc_not_exists.json
@@ -0,0 +1,8 @@
+{
+ "query": [
+ "https://ru.wikiloc.com/marshruty-baidarki/202106-petrovskiy-marathon-750378241",
+ "https://www.wikiloc.com/marshruty-baidarki/202106-petrovskiy-marathon-750378241",
+ "https://wikiloc.com/marshruty-baidarki/202106-petrovskiy-marathon-750378241"
+ ],
+ "geodata": [{"error": "Wikiloc trail does not exist"}]
+}
diff --git a/test/track_load_data/testcases/wikiloc_with_waypoints.json b/test/track_load_data/testcases/wikiloc_with_waypoints.json
@@ -0,0 +1,29 @@
+{
+ "query": [
+ "https://www.wikiloc.com/hiking-trails/test-test-zkouska-77022441",
+ "http://www.wikiloc.com/hiking-trails/test-test-zkouska-77022441",
+ "https://wikiloc.com/hiking-trails/test-test-zkouska-77022441",
+ "https://ru.wikiloc.com/hiking-trails/test-test-zkouska-77022441",
+ "https://www.wikiloc.com/hiking-trails/hello-77022441"
+ ],
+ "geodata": [
+ {
+ "name": "Test - Тест - Zkouška",
+ "tracks": [
+ [
+ {"lat": 56.526946, "lng": 28.962483},
+ {"lat": 56.526960, "lng": 28.962478},
+ {"lat": 56.527011, "lng": 28.962450},
+ {"lat": 56.527021, "lng": 28.962496},
+ {"lat": 56.527013, "lng": 28.962502},
+ {"lat": 56.527002, "lng": 28.962494},
+ {"lat": 56.527019, "lng": 28.962526}
+ ]
+ ],
+ "points": [
+ {"lat": 56.5263, "lng": 28.96245, "name": "Point 1"},
+ {"lat": 56.5264, "lng": 28.96246, "name": "Точка 2"}
+ ]
+ }
+ ]
+}