mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
c6b3142f09
Mirrors the qe-reasoning-bank split: the original 622-line file ran
~43 tests in a single fork, most of which spun up a full
AQELearningEngine (transformer + HNSW + WASM coherence) via
beforeEach. Distributing across three sequential forks (pool=forks,
maxForks=1, fileParallelism=false) caps per-fork heap.
- _aqe-engine-test-helpers.ts (NEW, not a test file)
Shared createMockMemoryBackend() and createMockEventBus() factories
pulled out of the original so the splits don't duplicate. Underscore
prefix keeps it out of vitest's test-file include glob.
- aqe-learning-engine-factory.test.ts (NEW, 4 tests, no init)
Factory Functions + DEFAULT_ENGINE_CONFIG. Tests only call the
constructor — no engine.initialize() — so transformer / HNSW /
WASM aren't loaded. Safe to include in test:unit:fast.
- aqe-learning-engine-patterns.test.ts (NEW, 15 tests, full engine)
The three heaviest sub-describes: Pattern Learning, Task Tracking,
Experience Capture Integration. Each test runs a full engine init.
Excluded from test:unit:fast until step 3's dispose hooks are
proven in CI.
- aqe-learning-engine.test.ts (SLIMMED, ~21 tests, full engine)
Init / Status / Task Routing / Model Routing / Codebase Analysis /
Guidance / Dispose. Header comment updated to reference the two
companion files. Inline mock factories replaced with imports from
the shared helper.
Coverage preserved: ~43 tests still run under test:ci, across three
forks instead of one.
Issue: #448
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
/**
|
|
* Unit Tests — AQELearningEngine factory + default-config
|
|
*
|
|
* Extracted from aqe-learning-engine.test.ts (issue #448, step 2). These
|
|
* are light tests — Factory Functions only call the constructor (no
|
|
* `engine.initialize()`, so no transformer / HNSW / WASM load), and
|
|
* DEFAULT_ENGINE_CONFIG is a plain constant assertion. Splitting them
|
|
* out keeps them out of the heavy fork's heap budget.
|
|
*/
|
|
|
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
import {
|
|
AQELearningEngine,
|
|
createAQELearningEngine,
|
|
createDefaultLearningEngine,
|
|
DEFAULT_ENGINE_CONFIG,
|
|
} from '../../../src/learning/aqe-learning-engine.js';
|
|
import type { MemoryBackend } from '../../../src/kernel/interfaces.js';
|
|
import { createMockMemoryBackend, createMockEventBus } from './_aqe-engine-test-helpers';
|
|
|
|
describe('Factory Functions', () => {
|
|
let memory: MemoryBackend;
|
|
|
|
beforeEach(() => {
|
|
memory = createMockMemoryBackend();
|
|
});
|
|
|
|
afterEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it('should create engine with createAQELearningEngine', () => {
|
|
const engine = createAQELearningEngine(memory, {
|
|
projectRoot: '/test',
|
|
});
|
|
|
|
expect(engine).toBeInstanceOf(AQELearningEngine);
|
|
});
|
|
|
|
it('should create engine with createDefaultLearningEngine', () => {
|
|
const engine = createDefaultLearningEngine(memory, '/test');
|
|
|
|
expect(engine).toBeInstanceOf(AQELearningEngine);
|
|
});
|
|
|
|
it('should accept optional event bus', () => {
|
|
const eventBus = createMockEventBus();
|
|
const engine = createAQELearningEngine(
|
|
memory,
|
|
{ projectRoot: '/test' },
|
|
eventBus
|
|
);
|
|
|
|
expect(engine).toBeInstanceOf(AQELearningEngine);
|
|
});
|
|
});
|
|
|
|
describe('DEFAULT_ENGINE_CONFIG', () => {
|
|
it('should have expected defaults', () => {
|
|
expect(DEFAULT_ENGINE_CONFIG.enableClaudeFlow).toBe(true);
|
|
expect(DEFAULT_ENGINE_CONFIG.enableExperienceCapture).toBe(true);
|
|
expect(DEFAULT_ENGINE_CONFIG.enablePatternPromotion).toBe(true);
|
|
expect(DEFAULT_ENGINE_CONFIG.promotionThreshold).toBe(3);
|
|
});
|
|
});
|