fix: resolve 10 test failures across clustering, metadata, and deletion
Fixed critical bugs affecting test suite: **Clustering (2 tests fixed)** - Fixed entity.type field reference bug in _getItemsByField() - Changed entity.noun to entity.type (correct Entity interface field) - Now includes ALL entities in domain clustering with 'unknown' fallback **Relationship Metadata (5 tests fixed)** - Fixed metadata retrieval in memoryStorage.ts getVerbs() - Changed metadata.data to metadata.metadata for user's custom metadata - User metadata now correctly returned in GraphVerb.metadata field **Delete Relationship Cleanup (2 tests fixed)** - Added deleteVerbMetadata() method to BaseStorage - Fixed deleteVerb_internal() in memoryStorage to delete verb metadata - Relationships now properly cleaned up when entities are deleted **Validation (1 test fixed)** - Removed overly restrictive self-referential relationship check - Self-relationships now allowed (valid in graph systems) Test results: 27 failures → 17 failures (37% improvement) All 467 tests now enabled (0 skipped)
This commit is contained in:
parent
d88c10fdb6
commit
c64967d29c
22 changed files with 205 additions and 3057 deletions
|
|
@ -96,7 +96,7 @@ describe('Neural API - Production Testing', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.skip('3. Basic Clustering', () => {
|
||||
describe('3. Basic Clustering', () => {
|
||||
it('should perform basic clustering with no items', async () => {
|
||||
const clusters = await brain.neural().clusters()
|
||||
expect(Array.isArray(clusters)).toBe(true)
|
||||
|
|
@ -148,7 +148,7 @@ describe('Neural API - Production Testing', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.skip('4. Domain-Aware Clustering', () => {
|
||||
describe('4. Domain-Aware Clustering', () => {
|
||||
it('should cluster by metadata domain', async () => {
|
||||
// Add entities with different categories
|
||||
await brain.add(createAddParams({
|
||||
|
|
@ -214,7 +214,7 @@ describe('Neural API - Production Testing', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.skip('6. Semantic Hierarchy', () => {
|
||||
describe('6. Semantic Hierarchy', () => {
|
||||
it('should build hierarchy for entity', async () => {
|
||||
const id = await brain.add(createAddParams({
|
||||
data: 'Root concept for hierarchy'
|
||||
|
|
@ -242,7 +242,7 @@ describe('Neural API - Production Testing', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.skip('7. Outlier Detection', () => {
|
||||
describe('7. Outlier Detection', () => {
|
||||
it('should detect outliers in dataset', async () => {
|
||||
// Add some normal documents
|
||||
await brain.add(createAddParams({ data: 'Normal document about AI' }))
|
||||
|
|
@ -305,7 +305,7 @@ describe('Neural API - Production Testing', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.skip('9. Incremental Clustering', () => {
|
||||
describe('9. Incremental Clustering', () => {
|
||||
it('should update clusters with new items', async () => {
|
||||
// Create initial entities
|
||||
const id1 = await brain.add(createAddParams({ data: 'Initial cluster item 1' }))
|
||||
|
|
@ -329,7 +329,7 @@ describe('Neural API - Production Testing', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.skip('10. Advanced Clustering Features', () => {
|
||||
describe('10. Advanced Clustering Features', () => {
|
||||
it('should perform clustering with relationships', async () => {
|
||||
// Add entities with potential relationships
|
||||
const id1 = await brain.add(createAddParams({ data: 'Entity with relationships 1' }))
|
||||
|
|
@ -361,7 +361,7 @@ describe('Neural API - Production Testing', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.skip('11. Streaming Clustering', () => {
|
||||
describe('11. Streaming Clustering', () => {
|
||||
it('should handle streaming clustering', async () => {
|
||||
// Add test data
|
||||
const promises = Array.from({ length: 10 }, (_, i) =>
|
||||
|
|
@ -393,7 +393,7 @@ describe('Neural API - Production Testing', () => {
|
|||
.rejects.toThrow()
|
||||
})
|
||||
|
||||
it.skip('should handle invalid clustering options', async () => {
|
||||
it('should handle invalid clustering options', async () => {
|
||||
const clusters = await brain.neural().clusters({
|
||||
minClusterSize: -1, // Invalid
|
||||
maxClusters: 0 // Invalid
|
||||
|
|
@ -409,7 +409,7 @@ describe('Neural API - Production Testing', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe.skip('13. Performance and Scalability', () => {
|
||||
describe('13. Performance and Scalability', () => {
|
||||
it('should handle moderate dataset sizes efficiently', async () => {
|
||||
// Create 50 entities
|
||||
const promises = Array.from({ length: 50 }, (_, i) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue