Merge branch 'worktree-agent-ad3aff0dffd17a6eb'
Some checks failed
CI / Node 22 (push) Successful in 12m19s
CI / Node 24 (push) Has been cancelled
CI / Integration + conformance (Node 22) (push) Has been cancelled
CI / Bun (latest) (push) Has been cancelled

This commit is contained in:
David Snelling 2026-08-25 11:47:25 -07:00
commit f14da34b27
12 changed files with 726 additions and 80 deletions

View file

@ -337,12 +337,18 @@ describe('Brainy 3.0 Core (Integration Tests - Real AI)', () => {
describe('Error Handling and Edge Cases', () => {
it('should handle invalid inputs gracefully', async () => {
// Empty data is rejected with a clear validation error (8.0 requires a
// non-empty `data` or a `vector` — empty string carries no signal to embed).
// Empty string is REAL content (e.g. an empty file's first write), not
// a missing field — only null/undefined data (with no vector either)
// is rejected. See src/utils/paramValidation.ts validateAddParams().
await expect(brain.add({
data: '',
type: 'document'
})).rejects.toThrow(/data/)
})).resolves.toBeDefined()
// Missing BOTH data and vector is still the real "nothing to embed" error.
await expect(brain.add({
type: 'document'
} as any)).rejects.toThrow(/data/)
// Test with very long text — valid input, resolves to an id.
const longText = 'Lorem ipsum '.repeat(10000)