feat(trucks): site_id column and site/truck helpers
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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 })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user