Merge branch 'worktree-agent-ad3aff0dffd17a6eb'
This commit is contained in:
commit
f14da34b27
12 changed files with 726 additions and 80 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue