mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-22 15:06:32 +00:00
feat: quality of life sweep from the feature discussions
Small requests from the discussions, each built end to end: planner and map (cycling mode, date first headings, clear a day, stay times per day, off-route stops, map lock, compact unplanned markers, pending stays, cable car, transit quick picks), places (location filter, category from OSM, open in maps, geo: link, image from an attachment, enrichment on file import, places near a pin, place name language, Amap first in China), lists and costs (packed counter, inherited sharing, Markdown to-dos, payment notes, bookings CSV, my plan PDF), sharing (unplanned places, travel only, without photos), journey (photo zoom, drafts, photo order, trip suggestion, day jump), atlas (region counter, region bucket list, places per country), vacay half company holidays, studio copy and paste plus the book's own layouts, and RESTORE_FROM_BACKUP for a first start restore.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
mapsSearchRequestSchema,
|
||||
mapsNearbyRequestSchema,
|
||||
mapsAutocompleteRequestSchema,
|
||||
mapsReverseQuerySchema,
|
||||
mapsResolveUrlRequestSchema,
|
||||
@@ -11,6 +12,17 @@ import {
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('mapsNearbyRequestSchema', () => {
|
||||
it('takes a point and caps the circle and the count', () => {
|
||||
expect(mapsNearbyRequestSchema.safeParse({ lat: 52.5, lng: 13.4 }).success).toBe(true);
|
||||
expect(mapsNearbyRequestSchema.safeParse({ lat: 52.5, lng: 13.4, radius: 5000, limit: 20 }).success).toBe(true);
|
||||
expect(mapsNearbyRequestSchema.safeParse({ lat: 52.5, lng: 13.4, radius: 5001 }).success).toBe(false);
|
||||
expect(mapsNearbyRequestSchema.safeParse({ lat: 52.5, lng: 13.4, limit: 21 }).success).toBe(false);
|
||||
expect(mapsNearbyRequestSchema.safeParse({ lat: 91, lng: 13.4 }).success).toBe(false);
|
||||
expect(mapsNearbyRequestSchema.safeParse({ lng: 13.4 }).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('mapsSearchRequestSchema', () => {
|
||||
it('requires a non-empty query', () => {
|
||||
expect(mapsSearchRequestSchema.safeParse({ query: 'berlin' }).success).toBe(true);
|
||||
|
||||
@@ -38,6 +38,21 @@ export const mapsSearchRequestSchema = z.object({
|
||||
});
|
||||
export type MapsSearchRequest = z.infer<typeof mapsSearchRequestSchema>;
|
||||
|
||||
/**
|
||||
* Places of any kind around a point, nearest first (#976). No category and no
|
||||
* box: the circle is the question. Both are capped, because the Google path
|
||||
* bills per call and a city centre has more named places than anyone reads.
|
||||
*/
|
||||
export const mapsNearbyRequestSchema = z.object({
|
||||
lat: z.number().min(-90).max(90),
|
||||
lng: z.number().min(-180).max(180),
|
||||
/** Metres, 500 when left out. */
|
||||
radius: z.number().int().min(50).max(5000).optional(),
|
||||
/** How many places, 20 when left out. */
|
||||
limit: z.number().int().min(1).max(20).optional(),
|
||||
});
|
||||
export type MapsNearbyRequest = z.infer<typeof mapsNearbyRequestSchema>;
|
||||
|
||||
export const mapsAutocompleteRequestSchema = z.object({
|
||||
input: z.string().min(1).max(200),
|
||||
lang: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user