feat(repos): resources (+ deps + creds) and source_docs

This commit is contained in:
root
2026-05-31 02:19:23 +10:00
parent 99d64221a0
commit c8649d753f
4 changed files with 198 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { resetDb } from '../helpers/db.js';
import { migrateUp } from '../../lib/db/migrate.js';
import * as spaces from '../../lib/db/repos/spaces.js';
import * as resources from '../../lib/db/repos/resources.js';
import * as sourceDocs from '../../lib/db/repos/source_docs.js';
const owner = { kind: 'user', id: null };
beforeEach(async () => { await resetDb(); await migrateUp(); });
describe('source_docs repo', () => {
it('creates a source doc bound to a resource', async () => {
const s = await spaces.create({ slug: 'h', name: 'H' }, owner);
const r = await resources.create({ space_id: s.id, slug: 'kk', name: 'KK', runtime_type: 'docker' }, owner);
const sd = await sourceDocs.create({
resource_id: r.id, name: 'Karakeep docs',
upstream_url: 'https://docs.karakeep.app', version: '0.20', format: 'markdown'
}, owner);
expect(sd.resource_id).toBe(r.id);
});
});