summaryrefslogtreecommitdiff
path: root/tests/placeZoomTest.js
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2022-05-30 22:47:07 +0200
committerMarcus Lundblad <ml@dfupdate.se>2022-06-08 22:08:34 +0200
commit0aa17f6ceafacf7c5268760f32d0ab3798b3e570 (patch)
tree3cf84c4a0810a51862a8c1183a11fb9cb8838916 /tests/placeZoomTest.js
parent220dfec3255c07ea71d6c1ca5dc5b5f9f263168a (diff)
downloadgnome-maps-0aa17f6ceafacf7c5268760f32d0ab3798b3e570.tar.gz
Migrate to ES6 modules
Switch to using ES6 modules for internal modules and GI modules instead of using the legacy imports object. The unit tests are still using imports.jsunit as this is not available as an ES6 module (the preferred solution now is to use jasmine-gjs). imports.bytearray, imports.format, and imports.mainloop are covered in follow-up commits.
Diffstat (limited to 'tests/placeZoomTest.js')
-rw-r--r--tests/placeZoomTest.js35
1 files changed, 15 insertions, 20 deletions
diff --git a/tests/placeZoomTest.js b/tests/placeZoomTest.js
index b99a16e8..27b147cd 100644
--- a/tests/placeZoomTest.js
+++ b/tests/placeZoomTest.js
@@ -20,27 +20,22 @@
*/
const JsUnit = imports.jsUnit;
-const PlaceZoom = imports.placeZoom;
+import * as PlaceZoom from './placeZoom.js';
-function main() {
- placeZoomTest();
-}
+// specific place types
+JsUnit.assertEquals(17,
+ PlaceZoom.getZoomLevelForPlace({ osmKey: 'shop',
+ osmValue: 'supermarket' }));
+JsUnit.assertEquals(4,
+ PlaceZoom.getZoomLevelForPlace({ osmKey: 'place',
+ osmValue: 'continent' }));
-function placeZoomTest() {
- // specific place types
- JsUnit.assertEquals(17,
- PlaceZoom.getZoomLevelForPlace({ osmKey: 'shop',
- osmValue: 'supermarket' }));
- JsUnit.assertEquals(4,
- PlaceZoom.getZoomLevelForPlace({ osmKey: 'place',
- osmValue: 'continent' }));
+// fallback for for OSM key
+JsUnit.assertEquals(17,
+ PlaceZoom.getZoomLevelForPlace({ osmKey: 'place',
+ osmValue: 'other' }));
- // fallback for for OSM key
- JsUnit.assertEquals(17,
- PlaceZoom.getZoomLevelForPlace({ osmKey: 'place',
- osmValue: 'other' }));
+// undefined for not defined type
+JsUnit.assertUndefined(PlaceZoom.getZoomLevelForPlace({ osmKey: 'type',
+ osmValue: 'other' }));
- // undefined for not defined type
- JsUnit.assertUndefined(PlaceZoom.getZoomLevelForPlace({ osmKey: 'type',
- osmValue: 'other' }));
-}