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
|
|
@ -6,7 +6,7 @@
|
|||
* validateInvariants(), and repairIndex() maps a failing invariant with heal:'rebuild'
|
||||
* to that provider's rebuild(). "healthy-while-broken must be impossible."
|
||||
*/
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
||||
import { Brainy, NounType } from '../../src/index.js'
|
||||
import type { ProviderInvariantReport } from '../../src/index.js'
|
||||
|
||||
|
|
@ -48,6 +48,10 @@ describe('validateIndexConsistency delegates to provider validateInvariants() (P
|
|||
await brain.flush()
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await brain.close()
|
||||
})
|
||||
|
||||
it('a broken provider report makes the store unhealthy and names the failing invariant', async () => {
|
||||
brain.index.validateInvariants = async () => brokenReport('vector')
|
||||
const v = await brain.validateIndexConsistency()
|
||||
|
|
|
|||
Reference in a new issue