Skip to content

Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.

TypeScript
657 B
Raw Blame
import assert from 'node:assert/strict'
import test from 'node:test'
import { chatSchema } from '../../app/validators/ollama.js'

const message = (content: string) => ({ role: 'user' as const, content })

test('text-only chat validation preserves empty and long conversation histories', async () => {
  const empty = await chatSchema.validate({
    model: 'text-model',
    messages: [],
    stream: true,
  })
  const long = await chatSchema.validate({
    model: 'text-model',
    messages: Array.from({ length: 201 }, (_, index) => message(`Message ${index}`)),
  })

  assert.equal(empty.messages.length, 0)
  assert.equal(long.messages.length, 201)
})