27 test files matched no vitest config, so they never ran in CI and gave false coverage confidence (the drift the audit flagged). - Re-homed 10 functional suites into the gate (renamed to *.unit.test.ts / *.integration.test.ts): Transaction + TransactionManager, type-utils, integrations/core + odata, comprehensive/public-api-complete, regression (metadata-index-cleanup + v5.7.0-deadlock), vfs/tree-operations + vfs-bulkwrite-race. ~192 previously-dark tests now run and pass. - Deleted 8 bit-rotted/redundant files that fail against 8.0 and never ran: one had a literal syntax error; one used filesystem writer-locks that polluted parallel runs; the rest assert old "Brainy 3.0/v3.0" APIs already covered by the live suites (api/batch-operations + crud-operations-enhanced, brainy-3, comprehensive/core-api + find-triple-intelligence, streaming-pipeline, vfs/vfs-relationships, transaction/integration/typeaware-transactions). - Added a coverage guard (tests/unit/test-suite-coverage-guard.test.ts) that FAILS CI if any *.test.ts ever again falls outside every config, with an explicit, conscious MANUAL_ONLY allowlist for the 9 genuine benchmark / perf / model-load files that are run by hand. Gate green: unit 1712, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
94 lines
3.4 KiB
TypeScript
94 lines
3.4 KiB
TypeScript
/**
|
|
* Tests for type utility functions
|
|
*
|
|
* This test file verifies that the utility functions for accessing noun and verb types
|
|
* work correctly and return the expected values.
|
|
*/
|
|
|
|
import { describe, it, expect } from 'vitest'
|
|
import {
|
|
NounType,
|
|
VerbType,
|
|
getNounTypes,
|
|
getVerbTypes,
|
|
getNounTypeMap,
|
|
getVerbTypeMap
|
|
} from '../src/index.js'
|
|
|
|
describe('Type Utility Functions', () => {
|
|
describe('getNounTypes', () => {
|
|
it('should return an array of all noun types', () => {
|
|
const nounTypes = getNounTypes()
|
|
|
|
// Check that the result is an array
|
|
expect(Array.isArray(nounTypes)).toBe(true)
|
|
|
|
// Check that it contains all the expected values
|
|
expect(nounTypes).toContain(NounType.Person)
|
|
expect(nounTypes).toContain(NounType.Organization)
|
|
expect(nounTypes).toContain(NounType.Location)
|
|
expect(nounTypes).toContain(NounType.Thing)
|
|
expect(nounTypes).toContain(NounType.Concept)
|
|
|
|
// Check that the length matches the number of properties in NounType
|
|
expect(nounTypes.length).toBe(Object.keys(NounType).length)
|
|
})
|
|
})
|
|
|
|
describe('getVerbTypes', () => {
|
|
it('should return an array of all verb types', () => {
|
|
const verbTypes = getVerbTypes()
|
|
|
|
// Check that the result is an array
|
|
expect(Array.isArray(verbTypes)).toBe(true)
|
|
|
|
// Check that it contains some expected values
|
|
expect(verbTypes).toContain(VerbType.RelatedTo)
|
|
expect(verbTypes).toContain(VerbType.Contains)
|
|
expect(verbTypes).toContain(VerbType.PartOf)
|
|
expect(verbTypes).toContain(VerbType.LocatedAt)
|
|
expect(verbTypes).toContain(VerbType.References)
|
|
|
|
// Check that the length matches the number of properties in VerbType
|
|
expect(verbTypes.length).toBe(Object.keys(VerbType).length)
|
|
})
|
|
})
|
|
|
|
describe('getNounTypeMap', () => {
|
|
it('should return a map of all noun type keys to values', () => {
|
|
const nounTypeMap = getNounTypeMap()
|
|
|
|
// Check that the result is an object
|
|
expect(typeof nounTypeMap).toBe('object')
|
|
|
|
// Check that it contains all the expected keys and values
|
|
expect(nounTypeMap.Person).toBe(NounType.Person)
|
|
expect(nounTypeMap.Organization).toBe(NounType.Organization)
|
|
expect(nounTypeMap.Location).toBe(NounType.Location)
|
|
expect(nounTypeMap.Thing).toBe(NounType.Thing)
|
|
expect(nounTypeMap.Concept).toBe(NounType.Concept)
|
|
|
|
// Check that the number of keys matches the number of properties in NounType
|
|
expect(Object.keys(nounTypeMap).length).toBe(Object.keys(NounType).length)
|
|
})
|
|
})
|
|
|
|
describe('getVerbTypeMap', () => {
|
|
it('should return a map of all verb type keys to values', () => {
|
|
const verbTypeMap = getVerbTypeMap()
|
|
|
|
// Check that the result is an object
|
|
expect(typeof verbTypeMap).toBe('object')
|
|
|
|
// Check that it contains all the expected keys and values
|
|
expect(verbTypeMap.RelatedTo).toBe(VerbType.RelatedTo)
|
|
expect(verbTypeMap.Contains).toBe(VerbType.Contains)
|
|
expect(verbTypeMap.PartOf).toBe(VerbType.PartOf)
|
|
expect(verbTypeMap.LocatedAt).toBe(VerbType.LocatedAt)
|
|
expect(verbTypeMap.References).toBe(VerbType.References)
|
|
|
|
// Check that the number of keys matches the number of properties in VerbType
|
|
expect(Object.keys(verbTypeMap).length).toBe(Object.keys(VerbType).length)
|
|
})
|
|
})
|
|
})
|