feat(repos): resources (+ deps + creds) and source_docs
This commit is contained in:
21
tests/repos/source_docs.test.js
Normal file
21
tests/repos/source_docs.test.js
Normal 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user