test(hygiene): close every brain the unit suite creates
Each file opened one or more Brainy instances (beforeEach, or a small per-test helper like migration-gate-family-scoped's module-level seed()) and never closed them. migration-gate-family-scoped.test.ts now tracks every brain seed() hands back in a describe-scoped array drained by afterEach, since the helper itself lives outside the describe block.
This commit is contained in:
parent
d6e7453f1f
commit
de79d6b5a4
16 changed files with 83 additions and 15 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* The 8.0 JS index cold-loads correctly, so we simulate the cold native failure
|
||||
* mode by intercepting the provider's getIdsForFilter/rebuild.
|
||||
*/
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
||||
import { Brainy, NounType, MetadataIndexNotReadyError } from '../../src/index.js'
|
||||
|
||||
const V = () => Array.from({ length: 384 }, (_, i) => Math.sin(i * 0.1) + 0.001)
|
||||
|
|
@ -31,6 +31,10 @@ describe('Metadata cold-read guard (#venue silent-[])', () => {
|
|||
await brain.flush()
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await brain.close()
|
||||
})
|
||||
|
||||
it('warm brain: filtered find is correct and the guard does not rebuild', async () => {
|
||||
const mi = brain.metadataIndex
|
||||
let rebuilds = 0
|
||||
|
|
|
|||
Reference in a new issue