Files
Void-Homelab/tests/repos/voice_clips.test.js
root 70bdba1a24 feat(dross): voice Phase 2b — clip retention (2.13.0)
'Keep voice clips' setting (default off). When on, /api/voice/transcribe
saves the audio (0600) to the owner-only ZFS subvol at /var/lib/void/
voice-clips (CT 311 mp0, replicated to Z3) + a voice_clips row (migration
029, transcript+metadata in void-db). New clips list/play/delete API +
Settings UI. Storage path is configurable (VOICE_CLIPS_DIR).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 01:27:40 +10:00

20 lines
901 B
JavaScript

import { describe, it, expect, beforeEach } from 'vitest';
import { resetDb } from '../helpers/db.js';
import { migrateUp } from '../../lib/db/migrate.js';
import * as clips from '../../lib/db/repos/voice_clips.js';
beforeEach(async () => { await resetDb(); await migrateUp(); });
describe('voice_clips repo', () => {
it('creates, lists newest-first, and removes (returning path)', async () => {
const a = await clips.create({ transcript: 'first', bytes: 10, mime: 'audio/webm', path: '/x/a.webm' });
const b = await clips.create({ transcript: 'second', bytes: 20, mime: 'audio/webm', path: '/x/b.webm' });
const list = await clips.list();
expect(list.length).toBe(2);
expect(list[0].transcript).toBe('second'); // newest first
const removed = await clips.remove(a.id);
expect(removed.path).toBe('/x/a.webm');
expect((await clips.list()).length).toBe(1);
});
});