test(hygiene): close every brain the vfs unit suite creates
Each file opened a Brainy per test (beforeEach) and never closed it.
This commit is contained in:
parent
de79d6b5a4
commit
be307a1579
3 changed files with 15 additions and 3 deletions
|
|
@ -3,7 +3,7 @@
|
|||
* Ensures tree methods prevent recursion and work correctly
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
||||
import { Brainy } from '../../src/brainy.js'
|
||||
import { VirtualFileSystem } from '../../src/vfs/VirtualFileSystem.js'
|
||||
import { VFSTreeUtils } from '../../src/vfs/TreeUtils.js'
|
||||
|
|
@ -24,6 +24,10 @@ describe('VFS Tree Operations', () => {
|
|||
await vfs.init()
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await brain.close()
|
||||
})
|
||||
|
||||
describe('Critical: No Self-Inclusion Bug', () => {
|
||||
it('should NEVER return a directory as its own child', async () => {
|
||||
// Create test structure
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* - Issue #2: File read decompression error
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
||||
import { Brainy } from '../../src/brainy.js'
|
||||
import { VirtualFileSystem } from '../../src/vfs/VirtualFileSystem.js'
|
||||
|
||||
|
|
@ -25,6 +25,10 @@ describe('VFS Bug Fixes', () => {
|
|||
await vfs.init()
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await brain.close()
|
||||
})
|
||||
|
||||
describe('Issue #1: Duplicate Directory Nodes', () => {
|
||||
it('should not create duplicate directory entries when writing multiple files to same directory', async () => {
|
||||
// Write multiple files to the same directory (reproduce the bug scenario)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
* other operations in parallel batches.
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
||||
import { Brainy } from '../../src/brainy.js'
|
||||
import { VirtualFileSystem } from '../../src/vfs/VirtualFileSystem.js'
|
||||
|
||||
|
|
@ -30,6 +30,10 @@ describe('VFS bulkWrite Race Condition Fix', () => {
|
|||
await vfs.init()
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await brain.close()
|
||||
})
|
||||
|
||||
describe('operation ordering', () => {
|
||||
it('should create directories before files when mixed in same batch', async () => {
|
||||
// This is the exact scenario that triggered the race condition:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue