import { describe, it, expect } from 'vitest' import { parseSiteId } from '@/lib/admin/truck-input' const UUID = '3f2b8c1e-9d4a-4e6f-8a1b-2c3d4e5f6a7b' describe('parseSiteId', () => { it('treats undefined as not provided', () => { expect(parseSiteId(undefined)).toEqual({ ok: true, value: undefined }) }) it('treats null and empty string as clear', () => { expect(parseSiteId(null)).toEqual({ ok: true, value: null }) expect(parseSiteId('')).toEqual({ ok: true, value: null }) }) it('accepts a uuid', () => { expect(parseSiteId(UUID)).toEqual({ ok: true, value: UUID }) }) it('rejects anything else', () => { expect(parseSiteId('abc')).toEqual({ ok: false }) expect(parseSiteId(12)).toEqual({ ok: false }) }) })