22 lines
967 B
JavaScript
22 lines
967 B
JavaScript
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);
|
|
});
|
|
});
|