MCPcopy Create free account
hub / github.com/cortexkit/magic-context / createTestDb

Function createTestDb

packages/plugin/src/tools/ctx-note/tools.test.ts:5–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { createCtxNoteTools } from "./tools";
4
5function createTestDb(): Database {
6 const db = new Database(":memory:");
7 db.exec(`
8 CREATE TABLE notes (
9 id INTEGER PRIMARY KEY AUTOINCREMENT,
10 type TEXT NOT NULL DEFAULT 'session',
11 status TEXT NOT NULL DEFAULT 'active',
12 content TEXT NOT NULL,
13 session_id TEXT,
14 project_path TEXT,
15 surface_condition TEXT,
16 created_at INTEGER NOT NULL,
17 updated_at INTEGER NOT NULL,
18 last_checked_at INTEGER,
19 ready_at INTEGER,
20 ready_reason TEXT,
21 harness TEXT NOT NULL DEFAULT 'opencode',
22 anchor_ordinal INTEGER
23 );
24 CREATE TABLE message_history_index (
25 session_id TEXT PRIMARY KEY,
26 last_indexed_ordinal INTEGER NOT NULL DEFAULT 0,
27 updated_at INTEGER NOT NULL DEFAULT 0,
28 harness TEXT NOT NULL DEFAULT 'opencode'
29 );
30 `);
31 return db;
32}
33
34const toolContext = (sessionID = "ses-note", directory = "/workspace/project-a") =>
35 ({ sessionID, directory }) as never;

Callers 1

tools.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected