Tonight
This commit is contained in:
parent
28323f145e
commit
94f9c0d594
76 changed files with 3238 additions and 1230 deletions
|
|
@ -1,11 +1,17 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { DENSITY_GRADIENT, ENUM_PALETTE, FEATURE_GRADIENT } from './consts';
|
||||
import {
|
||||
DENSITY_GRADIENT,
|
||||
ENUM_PALETTE,
|
||||
FEATURE_GRADIENT,
|
||||
SMALLEST_VISIBLE_HEXAGON_RESOLUTION,
|
||||
} from './consts';
|
||||
import {
|
||||
emojiToTwemojiUrl,
|
||||
enumIndexToColor,
|
||||
getBoundsFromViewState,
|
||||
getFeatureFillColor,
|
||||
getMapCenterForTargetScreenPoint,
|
||||
getPoiIconUrl,
|
||||
zoomToResolution,
|
||||
} from './map-utils';
|
||||
|
|
@ -16,6 +22,7 @@ describe('map utilities', () => {
|
|||
expect(zoomToResolution(7)).toBe(6);
|
||||
expect(zoomToResolution(10.6)).toBe(8);
|
||||
expect(zoomToResolution(14)).toBe(9);
|
||||
expect(SMALLEST_VISIBLE_HEXAGON_RESOLUTION).toBe(9);
|
||||
});
|
||||
|
||||
it('computes buffered bounds around a view state', () => {
|
||||
|
|
@ -31,6 +38,13 @@ describe('map utilities', () => {
|
|||
expect(bounds.east).toBeGreaterThan(-0.1);
|
||||
});
|
||||
|
||||
it('moves the map center so a target lands in the requested screen position', () => {
|
||||
const centered = getMapCenterForTargetScreenPoint(51.5, -0.1, 17, 390, 844, 195, 42.2);
|
||||
|
||||
expect(centered.longitude).toBeCloseTo(-0.1, 6);
|
||||
expect(centered.latitude).toBeLessThan(51.5);
|
||||
});
|
||||
|
||||
it('builds twemoji URLs and wraps enum colors', () => {
|
||||
expect(emojiToTwemojiUrl('🛒')).toBe('/assets/twemoji/1f6d2.png');
|
||||
expect(emojiToTwemojiUrl('')).toBe('/assets/twemoji/1f4cd.png');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue