The server no longer opens personal.mind, so tests build it on an empty data directory. The /memory command test seeds its two memories through server.memory and now checks that the seeded text is found.
31 lines
1017 B
TypeScript
31 lines
1017 B
TypeScript
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
import fs from 'node:fs';
|
|
import os from 'node:os';
|
|
import path from 'node:path';
|
|
import { BEHAVIORAL_SPEC } from '@waggle/agent';
|
|
import { buildLocalServer } from '../src/local/index.js';
|
|
import type { FastifyInstance } from 'fastify';
|
|
|
|
describe('activeBehavioralSpec integration', () => {
|
|
let tmpDir: string;
|
|
|
|
beforeAll(() => {
|
|
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-active-spec-'));
|
|
});
|
|
|
|
afterAll(() => {
|
|
try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch { /* ignore */ }
|
|
});
|
|
|
|
it('serves the compiled behavioral spec baseline', async () => {
|
|
const server = await buildLocalServer({ dataDir: tmpDir });
|
|
try {
|
|
expect(server.activeBehavioralSpec).toBeDefined();
|
|
expect(server.activeBehavioralSpec.rules).toBe(BEHAVIORAL_SPEC.rules);
|
|
expect(server.activeBehavioralSpec.coreLoop).toBe(BEHAVIORAL_SPEC.coreLoop);
|
|
} finally {
|
|
await server.close();
|
|
}
|
|
});
|
|
});
|