Skip to content

Commit 6093a10

Browse files
fix: Update test expectations for api skill and increase CLI test timeouts
- Add 'api' to expected skills list in claude-skills.test.ts - Increase init command test timeout to 15s - Increase status command test timeout to 10s
1 parent 24fef11 commit 6093a10

2 files changed

Lines changed: 45 additions & 24 deletions

File tree

src/cli/__tests__/index.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ vi.mock('util', async (importOriginal) => {
5858
const actual = await importOriginal();
5959
return {
6060
...actual,
61-
promisify: vi.fn(() => vi.fn().mockResolvedValue({ stdout: '', stderr: '' })),
61+
promisify: vi.fn(() =>
62+
vi.fn().mockResolvedValue({ stdout: '', stderr: '' })
63+
),
6264
};
6365
});
6466

@@ -301,7 +303,7 @@ describe('CLI Commands', () => {
301303

302304
const stackmemoryDir = join(tempDir, '.stackmemory');
303305
expect(existsSync(stackmemoryDir)).toBe(true);
304-
});
306+
}, 15000); // Increased timeout for module loading
305307
});
306308

307309
describe('status command', () => {
@@ -317,7 +319,7 @@ describe('CLI Commands', () => {
317319

318320
// Verify the command executed (it outputs session/status info)
319321
expect(consoleSpy.log).toHaveBeenCalled();
320-
});
322+
}, 10000);
321323

322324
it('should show error when StackMemory is not initialized', async () => {
323325
const { program } = await import('../index.js');

src/skills/__tests__/claude-skills.test.ts

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('Claude Skills', () => {
6363
outputs: [{ type: 'error', content: 'Test error' }],
6464
},
6565
]),
66-
getFrame: vi.fn().mockImplementation(id => {
66+
getFrame: vi.fn().mockImplementation((id) => {
6767
if (id === 'frame1') {
6868
return {
6969
frameId: 'frame1',
@@ -171,7 +171,9 @@ describe('Claude Skills', () => {
171171
const result = await skill.execute('teammate', 'Review needed');
172172

173173
expect(result.data?.actionItems).toBeDefined();
174-
expect(result.data?.actionItems).toContain('Resolve error in Test Frame 2');
174+
expect(result.data?.actionItems).toContain(
175+
'Resolve error in Test Frame 2'
176+
);
175177
// Frame 2 is type 'implementation' so should trigger test writing action
176178
expect(result.data?.actionItems.length).toBeGreaterThanOrEqual(1);
177179
});
@@ -210,7 +212,7 @@ describe('Claude Skills', () => {
210212

211213
// Verify file was created
212214
const files = fs.readdirSync(tempDir);
213-
expect(files.some(f => f.endsWith('.json'))).toBe(true);
215+
expect(files.some((f) => f.endsWith('.json'))).toBe(true);
214216
});
215217

216218
it('should create checkpoint with file backups', async () => {
@@ -223,7 +225,7 @@ describe('Claude Skills', () => {
223225
});
224226

225227
expect(result.success).toBe(true);
226-
228+
227229
// Verify file backup exists
228230
const checkpointId = result.data?.checkpointId;
229231
const filesDir = path.join(tempDir, checkpointId, 'files');
@@ -248,14 +250,14 @@ describe('Claude Skills', () => {
248250
});
249251

250252
expect(result.success).toBe(true);
251-
253+
252254
// Load checkpoint and verify metadata
253255
const files = fs.readdirSync(tempDir);
254256
const checkpointFile = files.find((f: any) => f.endsWith('.json'));
255257
const checkpoint = JSON.parse(
256258
fs.readFileSync(path.join(tempDir, checkpointFile!), 'utf-8')
257259
);
258-
260+
259261
expect(checkpoint.metadata.riskyOperation).toBe(true);
260262
expect(checkpoint.metadata.autoCheckpoint).toBe(true);
261263
});
@@ -289,7 +291,7 @@ describe('Claude Skills', () => {
289291
it('should diff two checkpoints', async () => {
290292
// Create first checkpoint
291293
const cp1 = await checkpointSkill.create('First');
292-
294+
293295
// Modify mock to return different frames
294296
mockDualStackManager.getActiveStack = vi.fn().mockReturnValue({
295297
getAllFrames: vi.fn().mockResolvedValue([
@@ -379,13 +381,15 @@ describe('Claude Skills', () => {
379381
frameId: 'f1',
380382
score: 0.9,
381383
timestamp: new Date().toISOString(),
382-
content: 'We decided to use JWT for authentication. This provides better security.',
384+
content:
385+
'We decided to use JWT for authentication. This provides better security.',
383386
},
384387
{
385388
frameId: 'f2',
386389
score: 0.8,
387390
timestamp: new Date().toISOString(),
388-
content: 'The team chose PostgreSQL over MongoDB for better ACID compliance.',
391+
content:
392+
'The team chose PostgreSQL over MongoDB for better ACID compliance.',
389393
},
390394
]);
391395

@@ -395,7 +399,9 @@ describe('Claude Skills', () => {
395399
});
396400

397401
expect(result.data?.decisions).toHaveLength(2);
398-
expect(result.data?.decisions[0].decision).toContain('decided to use JWT');
402+
expect(result.data?.decisions[0].decision).toContain(
403+
'decided to use JWT'
404+
);
399405
expect(result.data?.decisions[1].decision).toContain('chose PostgreSQL');
400406
});
401407

@@ -431,7 +437,7 @@ describe('Claude Skills', () => {
431437

432438
it('should parse different depth formats', async () => {
433439
const skill = new ArchaeologistSkill(context);
434-
440+
435441
await skill.dig('test', { depth: '7days' });
436442
await skill.dig('test', { depth: '2weeks' });
437443
await skill.dig('test', { depth: '3months' });
@@ -444,9 +450,13 @@ describe('Claude Skills', () => {
444450
describe('ClaudeSkillsManager', () => {
445451
it('should execute handoff skill', async () => {
446452
const manager = new ClaudeSkillsManager(context);
447-
const result = await manager.executeSkill('handoff', ['user2', 'Test message'], {
448-
priority: 'high',
449-
});
453+
const result = await manager.executeSkill(
454+
'handoff',
455+
['user2', 'Test message'],
456+
{
457+
priority: 'high',
458+
}
459+
);
450460

451461
expect(result.success).toBe(true);
452462
expect(result.data?.handoffId).toBe('handoff-test-123');
@@ -456,8 +466,11 @@ describe('Claude Skills', () => {
456466
const manager = new ClaudeSkillsManager(context);
457467
// Override checkpoint dir
458468
(manager as any).checkpointSkill.checkpointDir = tempDir;
459-
460-
const result = await manager.executeSkill('checkpoint', ['create', 'Test checkpoint']);
469+
470+
const result = await manager.executeSkill('checkpoint', [
471+
'create',
472+
'Test checkpoint',
473+
]);
461474

462475
expect(result.success).toBe(true);
463476
expect(result.data?.checkpointId).toBeDefined();
@@ -485,20 +498,26 @@ describe('Claude Skills', () => {
485498
const manager = new ClaudeSkillsManager(context);
486499
const skills = manager.getAvailableSkills();
487500

488-
expect(skills).toEqual(['handoff', 'checkpoint', 'dig', 'dashboard']);
501+
expect(skills).toEqual([
502+
'handoff',
503+
'checkpoint',
504+
'dig',
505+
'dashboard',
506+
'api',
507+
]);
489508
});
490509

491510
it('should get skill help', () => {
492511
const manager = new ClaudeSkillsManager(context);
493-
512+
494513
const handoffHelp = manager.getSkillHelp('handoff');
495514
expect(handoffHelp).toContain('/handoff @user');
496-
515+
497516
const checkpointHelp = manager.getSkillHelp('checkpoint');
498517
expect(checkpointHelp).toContain('/checkpoint create');
499-
518+
500519
const digHelp = manager.getSkillHelp('dig');
501520
expect(digHelp).toContain('/dig "query"');
502521
});
503522
});
504-
});
523+
});

0 commit comments

Comments
 (0)