Api: dzien z aktywna sesja nie wygasa o polnocy (trening nie jest przerywany; twardym limitem pozostaje 24h)
This commit is contained in:
@@ -36,10 +36,16 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe('scheduler', () => {
|
||||
it('auto-expires planned days before today', async () => {
|
||||
it('auto-expires planned days before today, but not days with an in-progress session', async () => {
|
||||
await tickOnce();
|
||||
expect(planDayUpdateMany).toHaveBeenCalledWith({
|
||||
where: { status: 'PLANNED', date: { lt: new Date(2026, 7, 22) } },
|
||||
where: {
|
||||
status: 'PLANNED',
|
||||
date: { lt: new Date(2026, 7, 22) },
|
||||
// północ nie może przerwać trwającego treningu — dzień z sesją IN_PROGRESS
|
||||
// nie wygasa; domknie go ukończenie sesji albo reguła 24h
|
||||
sessions: { none: { status: 'IN_PROGRESS' } },
|
||||
},
|
||||
data: { status: 'SKIPPED', skippedAt: expect.any(Date) },
|
||||
});
|
||||
expect(planDayUpdateMany.mock.calls[0][0].data.skippedAt).toEqual(NOW);
|
||||
|
||||
Reference in New Issue
Block a user