fix architecture and write new tests

This commit is contained in:
root
2026-06-10 00:40:19 -04:00
parent 560da1cadf
commit 80a597bc10
377 changed files with 84020 additions and 1337 deletions
@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest'
import { reportQuerySchema, summaryQuerySchema } from './analytics.schemas'
describe('analytics schema contracts', () => {
it('defaults summary period to the 30 day window', () => {
expect(summaryQuerySchema.parse({})).toEqual({ period: '30d' })
})
it('defaults reports to JSON while preserving explicit date range filters', () => {
expect(reportQuerySchema.parse({ from: '2026-01-01', to: '2026-01-31' })).toEqual({
from: '2026-01-01',
to: '2026-01-31',
format: 'JSON',
})
})
it('passes CSV format and period through without lowercasing surprises', () => {
expect(reportQuerySchema.parse({ format: 'CSV', period: 'quarter' })).toEqual({
format: 'CSV',
period: 'quarter',
})
})
})