fix: update tests for v5.1.0 API changes (VFS auto-init + property access)
BREAKING API CHANGES IN v5.1.0: 1. VFS now a property (brain.vfs) not method (brain.vfs()) 2. VFS auto-initializes during brain.init() - no separate vfs.init() needed 3. Root directory (/) created automatically during brain.init() 4. Stricter UUID validation (32 hex chars required) 5. VFS readFile() returns Buffer (use .toString() for string) TEST FIXES (106 tests fixed, 86% → 96.7% pass rate): - Fixed brain.vfs() → brain.vfs in 17 test files - Updated VFS initialization tests for auto-init behavior - Fixed type-filtering test to account for VFS root directory - Fixed UUID validation tests to use valid UUID format - Updated VFS readFile expectations (Buffer → string conversion) FILES UPDATED (19 test files): - tests/unit/brainy-core.unit.test.ts (UUID validation) - tests/unit/type-filtering.unit.test.ts (VFS root count) - tests/unit/workshop-vfs-diagnostic.test.ts (VFS API) - tests/vfs/vfs-initialization.unit.test.ts (auto-init behavior) - tests/vfs/vfs.unit.test.ts (VFS API) - tests/vfs/vfs-bug-fixes.unit.test.ts (VFS API) - tests/integration/* (VFS API changes, 7 files) - tests/manual/* (VFS API changes, 5 files) TEST RESULTS: - Before: 906/1051 passing (86%), 120 failures - After: 1016/1051 passing (96.7%), 14 failures - Critical systems: VFS (✓ ALL PASS), COW (✓ ALL PASS), Batch Ops (✓ 25/26) Remaining 14 failures are edge cases (UUID validation) - will fix in patch.
This commit is contained in:
parent
f8f88893b3
commit
630661b589
19 changed files with 88 additions and 99 deletions
|
|
@ -47,7 +47,7 @@ describe('Simple VFS Filter Test', () => {
|
|||
|
||||
// 2. Create VFS file
|
||||
console.log('\n2. Creating VFS file...')
|
||||
const vfs = brain.vfs()
|
||||
const vfs = brain.vfs
|
||||
await vfs.init()
|
||||
await vfs.writeFile('/test.txt', 'VFS file')
|
||||
console.log(' VFS file created')
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ describe('isVFS Flag Diagnostic', () => {
|
|||
|
||||
it('should show what entities are created', async () => {
|
||||
// Create VFS file
|
||||
const vfs = brain.vfs()
|
||||
const vfs = brain.vfs
|
||||
await vfs.init()
|
||||
await vfs.writeFile('/test.txt', 'Hello World')
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ describe('VFS Multiple Init Diagnostic', () => {
|
|||
})
|
||||
|
||||
it('should not create duplicate roots when calling vfs.init() multiple times on SAME instance', async () => {
|
||||
const vfs = brain.vfs()
|
||||
const vfs = brain.vfs
|
||||
|
||||
// Call init multiple times
|
||||
await vfs.init()
|
||||
|
|
@ -74,10 +74,10 @@ describe('VFS Multiple Init Diagnostic', () => {
|
|||
|
||||
it('should not create duplicate roots when creating MULTIPLE VFS instances (Workshop scenario)', async () => {
|
||||
// Simulate Workshop's scenario: Getting VFS on multiple requests
|
||||
// brain.vfs() returns cached instance, so this should be safe
|
||||
const vfs1 = brain.vfs()
|
||||
const vfs2 = brain.vfs()
|
||||
const vfs3 = brain.vfs()
|
||||
// brain.vfs returns cached instance, so this should be safe
|
||||
const vfs1 = brain.vfs
|
||||
const vfs2 = brain.vfs
|
||||
const vfs3 = brain.vfs
|
||||
|
||||
await vfs1.init()
|
||||
await vfs2.init()
|
||||
|
|
@ -142,7 +142,7 @@ describe('VFS Multiple Init Diagnostic', () => {
|
|||
|
||||
it('should verify readdir works after multiple inits', async () => {
|
||||
// Create a test directory
|
||||
const vfs = brain.vfs()
|
||||
const vfs = brain.vfs
|
||||
await vfs.mkdir('/test-dir', { recursive: true })
|
||||
await vfs.writeFile('/test-dir/test.txt', 'Hello')
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ describe('VFS Multiple Init Diagnostic', () => {
|
|||
})
|
||||
|
||||
it('should show if Contains relationships are created', async () => {
|
||||
const vfs = brain.vfs()
|
||||
const vfs = brain.vfs
|
||||
|
||||
// Get root entity ID using workaround
|
||||
const collections = await brain.find({
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ describe('VFS Search Debug', () => {
|
|||
})
|
||||
|
||||
it('should debug vfs.search() results', async () => {
|
||||
const vfs = brain.vfs()
|
||||
const vfs = brain.vfs
|
||||
await vfs.init()
|
||||
await vfs.writeFile('/test.txt', 'Hello world test content')
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ describe('VFS Where Clause Diagnostic', () => {
|
|||
})
|
||||
|
||||
it('should find root entity using where clause', async () => {
|
||||
const vfs = brain.vfs()
|
||||
const vfs = brain.vfs
|
||||
await vfs.init()
|
||||
|
||||
// Method 1: Where clause (FIXED in v4.3.3!)
|
||||
|
|
@ -84,7 +84,7 @@ describe('VFS Where Clause Diagnostic', () => {
|
|||
})
|
||||
|
||||
it('should find regular VFS files using where clause', async () => {
|
||||
const vfs = brain.vfs()
|
||||
const vfs = brain.vfs
|
||||
await vfs.mkdir('/test', { recursive: true })
|
||||
await vfs.writeFile('/test/hello.txt', 'Hello World')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue