Improved import security, added browser tests
Some checks failed
Tests et déploiement / deploy (push) Has been cancelled
Tests et déploiement / validate (push) Has been cancelled

This commit is contained in:
2026-10-08 21:34:58 +02:00
parent 5cf19bb8ac
commit b0aa5acf4b
28 changed files with 793 additions and 99 deletions

View File

@@ -6,7 +6,7 @@ import { buildStats } from './stats.js';
import { buildBackup, parseBackup } from './backup.js';
import { buildModel } from './predict.js';
import { automateDay } from './automation.js';
import { insertRecordedEntry, removeRecordedEntry, saveRecordedEntry } from './editing.js';
import { insertGapEntry, insertRecordedEntry, removeRecordedEntry, saveRecordedEntry } from './editing.js';
import { DEFAULT_SETTINGS } from './settings.svelte.js';
import { atLocalTime, HOUR, MINUTE } from './time.js';
const date = '2026-10-08';
@@ -113,3 +113,23 @@ describe('preserving imported gaps while editing', () => {
expect(rows[0].endTs).toBe(at('11:00')); expect(rows[1].startTs).toBe(at('13:00'));
});
});
it('refuses to resume a closure that was corrected after confirmation opened', async () => {
await install([slot(0,'work','08:00','17:00')]);
const original = (await getEntries(date))[0];
await saveRecordedEntry(original,{...original,endTs:at('16:30')},at('18:00'));
await expect(reopenDay(date,at('18:00'),'break',{date,endedTs:at('17:00'),last:original})).rejects.toThrow(/a changé/);
expect((await getDay(date)).status).toBe('closed');
expect(await getEntries(date)).toHaveLength(1);
});
it('records a pause within a gap without changing either work neighbour', async () => {
await install([slot(0,'work','08:00','11:00'),slot(1,'work','13:00','17:00')]);
const [previous, following] = await getEntries(date);
await insertGapEntry(previous, following, slot(0,'break','11:30','12:30'), at('18:00'));
const rows = await getEntries(date);
expect(rows.map(row => row.kind)).toEqual(['work','break','work']);
expect(rows[0].endTs).toBe(at('11:00')); expect(rows[2].startTs).toBe(at('13:00'));
expect(buildStats([day],rows).quality.uncoveredMs).toBe(HOUR);
await expect(insertGapEntry(previous,following,slot(0,'break','11:30','12:30'),at('18:00'))).rejects.toThrow(/a changé/);
});