Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

repo-report-schema.test.ts

32 lines912 Bytes

1import { describe, expect, it } from 'vitest'
2import { looksLikeReport } from './repo-report-schema'
3​
4describe('looksLikeReport', () => {
5 it('accepts a complete report', () => {
6 expect(
7 looksLikeReport({
8 name: 'TanStack AI',
9 oneLiner: 'A type-safe AI SDK.',
10 audience: 'TypeScript developers',
11 mainPackages: [{ name: '@tanstack/ai', role: 'core' }],
12 howToRun: 'pnpm install',
13 }),
14 ).toBe(true)
15 })
16​
17 it('accepts a partial report while fields stream in', () => {
18 expect(looksLikeReport({ name: 'TanStack AI' })).toBe(true)
19 })
20​
21 it('rejects a string in mainPackages', () => {
22 expect(looksLikeReport({ mainPackages: 'invalid' })).toBe(false)
23 })
24​
25 it('rejects a non-string name', () => {
26 expect(looksLikeReport({ name: {} })).toBe(false)
27 })
28​
29 it('rejects an empty object', () => {
30 expect(looksLikeReport({})).toBe(false)
31 })
32})