peterfei/ai-agent-team / .claude/skills/thread-manager
thread-manager
Flaggedtests/unit/database.test.ts
View on GitHubimport { DatabaseManager } from '../../src/database/db';
import path from 'path';
import fs from 'fs-extra';
import { v4 as uuidv4 } from 'uuid';
describe('DatabaseManager', () => {
const testDir = path.join(__dirname, '../../tmp-test-db');
const dbPath = path.join(testDir, `test-${uuidv4()}.db`);
let dbManager: DatabaseManager;
beforeAll(() => {
fs.ensureDirSync(testDir);
});
afterAll(() => {
fs.removeSync(testDir);
});
beforeEach(() => {
dbManager = new DatabaseManager(dbPath);
dbManager.init();
});
afterEach(() => {
dbManager.close();
if (fs.existsSync(dbPath)) {
fs.unlinkSync(dbPath);
}
});
it('should create database file', () => {
expect(fs.existsSync(dbPath)).toBe(true);
});
it('should create all tables', () => {
const db = dbManager.getDatabase();
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table'").all() as { name: string }[];
const tableNames = tables.map(t => t.name);
expect(tableNames).toContain('threads');
expect(tableNames).toContain('messages');
expect(tableNames).toContain('file_changes');
});
it('should be able to insert a thread', () => {
const db = dbManager.getDatabase();
const id = uuidv4();
const now = Date.now();
const stmt = db.prepare(`
INSERT INTO threads (id, title, created_at, updated_at, is_active)
VALUES (?, ?, ?, ?, ?)
`);
stmt.run(id, 'Test Thread', now, now, 1);
const row = db.prepare('SELECT * FROM threads WHERE id = ?').get(id) as any;
expect(row).toBeDefined();
expect(row.title).toBe('Test Thread');
expect(row.is_active).toBe(1);
});
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |