import React from 'react';
import ReactLeafletDriftMarker from 'react-leaflet-drift-marker';
import geohashAnimation from './geohash';
/**
* Test the geohashAnimation function when changing geohash levels by zooming out on the map.
* The markers returned by geohashAnimation() should be a combination of `prevMarkers` and `markers`
* but with the 'prevMarkers' having the position of their corresponding markers in 'markers'.
**/
test('geohashAnimation Test Zoom Out', () => {
const prevMarkers = [
,
,
,
,
];
const markers = [
,
,
];
const consolidatedMarkers = [
,
,
,
,
,
,
];
expect(geohashAnimation({ prevMarkers, markers })).toEqual({
zoomType: 'out',
markers: consolidatedMarkers,
});
});
/**
* Test the geohashAnimation function when changing geohash levels by zooming in on the map.
* The markers returned by geohashAnimation() should be the same markers as `markers` but with
* their corresponding markers position in `prevMarkers`.
**/
test('geohashAnimation Test Zoom In', () => {
const prevMarkers = [
,
,
,
,
];
const markers = [
,
,
,
,
,
,
,
];
const consolidatedMarkers = [
,
,
,
,
,
,
,
];
expect(geohashAnimation({ prevMarkers, markers })).toEqual({
zoomType: 'in',
markers: consolidatedMarkers,
});
});
/**
* Test the geohashAnimation function when no geohash level changes.
* The markers returned by geohashAnimation() should be the same as 'markers' because the final
* markers are just themselves without adopting any previous marker's position.
**/
test('geohashAnimation Test No Geohash Level Change', () => {
const prevMarkers = [
,
,
,
,
];
const markers = [
,
,
,
,
,
,
,
,
,
,
,
,
,
];
expect(geohashAnimation({ prevMarkers, markers })).toEqual({
zoomType: null,
markers: markers,
});
});