mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
test(memory-command): add unit tests for memory module
Solution-ID: SOL-1735386000001 Issue-ID: ISS-1766921318981-15 Task-ID: T2
This commit is contained in:
@@ -220,6 +220,27 @@ describe('memory command module', async () => {
|
||||
assert.ok(logs.some((l) => l.includes('Nothing to prune') || l.includes('No memory database found')));
|
||||
});
|
||||
|
||||
it('prune validates age format', async () => {
|
||||
stubHttpRequest();
|
||||
|
||||
const errors: string[] = [];
|
||||
mock.method(console, 'log', () => {});
|
||||
mock.method(console, 'error', (...args: any[]) => {
|
||||
errors.push(args.map(String).join(' '));
|
||||
});
|
||||
|
||||
mock.method(process as any, 'exit', (code?: number) => {
|
||||
throw new ExitError(code);
|
||||
});
|
||||
|
||||
await assert.rejects(
|
||||
memoryModule.memoryCommand('prune', [], { olderThan: 'not-an-age', dryRun: true }),
|
||||
(err: any) => err instanceof ExitError && err.code === 1,
|
||||
);
|
||||
|
||||
assert.ok(errors.some((e) => e.includes('Invalid age format')));
|
||||
});
|
||||
|
||||
it('embed/embed-status/semantic-search fail fast without core-memory database', async () => {
|
||||
stubHttpRequest();
|
||||
|
||||
@@ -258,4 +279,3 @@ describe('memory command module', async () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user