fix: Sprachnotizen werden bei ausgeschalteter Aufnahme abgelehnt
POST /voice-captures und /voice-captures/text antworten mit 403 VOICE_RECORDING_DISABLED („Sprachnotizen sind gerade ausgeschaltet.“), solange VOICE_RECORDING_ENABLED nicht true ist; Liste, Abruf, Wiederholen und Verwerfen bleiben möglich (Ruling 14). Refs #27 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
484d799a36
commit
462ac46d1e
4 files changed
+84
-1
No files matched your search
@@ -120,7 +120,11 @@ describe('Voice captures (e2e)', () => {
|
||||
tokens[name] = (await login(app, emailOf(name), password)).accessToken;
|
||||
}
|
||||
|
||||
const originalRecording = process.env.VOICE_RECORDING_ENABLED;
|
||||
|
||||
beforeAll(async () => {
|
||||
// Notes are only accepted while recording is on; this file turns it on.
|
||||
process.env.VOICE_RECORDING_ENABLED = 'true';
|
||||
app = await createTestApp();
|
||||
prisma = app.get(PrismaService);
|
||||
|
||||
@@ -208,6 +212,11 @@ describe('Voice captures (e2e)', () => {
|
||||
where: { name: `Voice E2E Stand ${suffix}` },
|
||||
});
|
||||
await app.close();
|
||||
if (originalRecording === undefined) {
|
||||
delete process.env.VOICE_RECORDING_ENABLED;
|
||||
} else {
|
||||
process.env.VOICE_RECORDING_ENABLED = originalRecording;
|
||||
}
|
||||
});
|
||||
|
||||
const ownRows = (name: string) =>
|
||||
@@ -280,6 +289,35 @@ describe('Voice captures (e2e)', () => {
|
||||
expect(rows[0].TimeZone).toBe('UTC');
|
||||
});
|
||||
|
||||
describe('recording switch', () => {
|
||||
it('refuses new notes while off but still lists, reads and discards', async () => {
|
||||
const id = ((await sendText('alice').expect(201)).body as CaptureBody).id;
|
||||
process.env.VOICE_RECORDING_ENABLED = 'false';
|
||||
try {
|
||||
const up = await upload('alice').expect(403);
|
||||
expect(up.body).toMatchObject({
|
||||
code: 'VOICE_RECORDING_DISABLED',
|
||||
message: 'Sprachnotizen sind gerade ausgeschaltet.',
|
||||
});
|
||||
await sendText('alice').expect(403);
|
||||
await request(server())
|
||||
.get('/api/v1/voice-captures')
|
||||
.set(as('alice'))
|
||||
.expect(200);
|
||||
await request(server())
|
||||
.get(`/api/v1/voice-captures/${id}`)
|
||||
.set(as('alice'))
|
||||
.expect(200);
|
||||
await request(server())
|
||||
.post(`/api/v1/voice-captures/${id}/discard`)
|
||||
.set(as('alice'))
|
||||
.expect(204);
|
||||
} finally {
|
||||
process.env.VOICE_RECORDING_ENABLED = 'true';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('upload', () => {
|
||||
it('stores the audio sealed and answers QUEUED', async () => {
|
||||
const response = await upload('alice').expect(201);
|
||||
|
||||
Reference in new issue
Block a user