CHECKPOINT: Brainy 2.0 API refactor - pre-fixes state
Current state: - Unified augmentation system to BrainyAugmentation interface - Changed methods to specific noun/verb naming (addNoun, getNoun, etc) - Made old methods private - Combined getNouns into single unified method - Neural API exists and is complete - Triple Intelligence uses correct Brainy operators (not MongoDB) Issues identified: - Documentation incorrectly shows MongoDB operators (code is correct) - Need to ensure all features are properly exposed - Need to verify nothing was lost in simplification This commit serves as a rollback point before applying fixes.
This commit is contained in:
commit
26c7d61185
279 changed files with 177945 additions and 0 deletions
89
test-storage-augmentation.js
Normal file
89
test-storage-augmentation.js
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/**
|
||||
* Test script to verify storage augmentation system works
|
||||
*/
|
||||
|
||||
import { BrainyData } from './dist/brainyData.js'
|
||||
import {
|
||||
MemoryStorageAugmentation,
|
||||
FileSystemStorageAugmentation
|
||||
} from './dist/augmentations/storageAugmentations.js'
|
||||
|
||||
console.log('🧪 Testing Storage Augmentation System')
|
||||
console.log('=' .repeat(50))
|
||||
|
||||
async function test1_ZeroConfig() {
|
||||
console.log('\n1. Zero-Config Test')
|
||||
const brain = new BrainyData()
|
||||
await brain.init()
|
||||
|
||||
await brain.add('test', { content: 'Zero-config test' })
|
||||
const results = await brain.search('test', 1)
|
||||
|
||||
console.log('✅ Zero-config works:', results.length > 0)
|
||||
await brain.destroy()
|
||||
}
|
||||
|
||||
async function test2_ConfigBased() {
|
||||
console.log('\n2. Config-Based Storage Test')
|
||||
const brain = new BrainyData({
|
||||
storage: {
|
||||
forceMemoryStorage: true
|
||||
}
|
||||
})
|
||||
await brain.init()
|
||||
|
||||
await brain.add('config test', { content: 'Config-based test' })
|
||||
const results = await brain.search('config', 1)
|
||||
|
||||
console.log('✅ Config-based works:', results.length > 0)
|
||||
await brain.destroy()
|
||||
}
|
||||
|
||||
async function test3_AugmentationOverride() {
|
||||
console.log('\n3. Augmentation Override Test')
|
||||
const brain = new BrainyData()
|
||||
|
||||
// Register storage augmentation BEFORE init
|
||||
brain.augmentations.register(new MemoryStorageAugmentation('test-memory'))
|
||||
|
||||
await brain.init()
|
||||
|
||||
await brain.add('augmentation test', { content: 'Augmentation override test' })
|
||||
const results = await brain.search('augmentation', 1)
|
||||
|
||||
console.log('✅ Augmentation override works:', results.length > 0)
|
||||
await brain.destroy()
|
||||
}
|
||||
|
||||
async function test4_BackwardCompatibility() {
|
||||
console.log('\n4. Backward Compatibility Test')
|
||||
|
||||
// Old style with rootDirectory config
|
||||
const brain = new BrainyData({
|
||||
storage: {
|
||||
rootDirectory: './test-data',
|
||||
forceFileSystemStorage: true
|
||||
}
|
||||
})
|
||||
|
||||
await brain.init()
|
||||
console.log('✅ Backward compatible config works')
|
||||
await brain.destroy()
|
||||
}
|
||||
|
||||
async function runAllTests() {
|
||||
try {
|
||||
await test1_ZeroConfig()
|
||||
await test2_ConfigBased()
|
||||
await test3_AugmentationOverride()
|
||||
await test4_BackwardCompatibility()
|
||||
|
||||
console.log('\n' + '='.repeat(50))
|
||||
console.log('✅ ALL STORAGE AUGMENTATION TESTS PASSED!')
|
||||
} catch (error) {
|
||||
console.error('❌ Test failed:', error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
runAllTests()
|
||||
Loading…
Add table
Add a link
Reference in a new issue