Files
Void-Homelab/tests/db/migration_007.test.js
2026-06-01 18:06:34 +10:00

24 lines
911 B
JavaScript

import { describe, it, expect, beforeAll } from 'vitest';
import { pool } from '../../lib/db/pool.js';
import { resetDb } from '../helpers/db.js';
import { migrateUp } from '../../lib/db/migrate.js';
beforeAll(async () => { await resetDb(); await migrateUp(); });
describe('migration 007', () => {
it('adds conversations.space_id column', async () => {
const { rows } = await pool.query(
`SELECT column_name FROM information_schema.columns
WHERE table_name='conversations' AND column_name='space_id'`
);
expect(rows).toHaveLength(1);
});
it('seeds a default companion agent', async () => {
const { rows } = await pool.query(`SELECT slug, kind, capabilities FROM agents WHERE slug='companion'`);
expect(rows).toHaveLength(1);
expect(rows[0].kind).toBe('claude');
expect(rows[0].capabilities).toMatchObject({ read: true, suggest: true, write: false });
});
});