import { describe, expect, it } from 'vitest' import { isCanonicalEventLandingRoute, isEventUuid, isLegacyEventDetailRoute, isLegacyEventLandingRoute, isPublicEventSlug, } from '@/lib/routing/eventRoute' const eventId = '462f10ff-7466-4a58-9631-d09f02b76eaf' describe('event route classification', () => { it('keeps public slugs distinct from UUIDs and reserved application routes', () => { expect(isPublicEventSlug('tehran-book-club')).toBe(true) expect(isPublicEventSlug('new')).toBe(false) expect(isPublicEventSlug(eventId)).toBe(false) expect(isEventUuid(eventId)).toBe(true) }) it('classifies canonical /e, UUID legacy, and /events legacy URLs independently', () => { expect(isCanonicalEventLandingRoute('/e/tehran-book-club')).toBe(true) expect(isCanonicalEventLandingRoute(`/e/${eventId}`)).toBe(false) expect(isLegacyEventDetailRoute(`/events/${eventId}`)).toBe(true) expect(isLegacyEventLandingRoute('/events/tehran-book-club')).toBe(true) }) it('does not classify nested management paths or malformed encodings as landings', () => { expect(isCanonicalEventLandingRoute('/e/tehran-book-club/manage')).toBe(false) expect(isCanonicalEventLandingRoute('/e/%E0%A4%A')).toBe(false) }) })